简体   繁体   中英

What is application mode in terminals/zsh/terminfo?

In several places I see some commands to ensure that terminal (?) is in application mode , then terminfo database to set/query key bindings will work.

I tried to find what is this application mode , but I had no success. What is this application mode? I think Zsh can run fine without it. Am I right? Would be desirable to unset it after the key bindings were processed? Won't some applications like the curses-based ones unset it?

This is only one question: "What is application mode or how it works". I wrote the other questions only to help you understand my problem.

In case anyone face the same issue... After some research, I found the answer to my question(s) under one prezto's pull request .

It can be summarized like this:

  1. terminals are underspecified and non-universal. There were several different protocols to handle extensions that move the cursor, change color and handle user's key combination inputs.
  2. Somebody created a big database to abstract differences among different terminals and terminals emulators. This database is the terminfo.
  3. terminfo only works under application mode. Special escape sequences are issued to the terminal, then it can change its mode. In the new mode, it will accept different escape sequences (the ones known by terminfo).
  4. It is possible to detect if application mode is supported and fallback to other methods (zkbd, ...) if not.
  5. zsh's common configurations setup zle (the zsh's line editor) to enter in application mode before receiving user input and exit before executing any commands. Then all applications will continue to behave normally.

Note: Not all common zsh's configurations are that robust and a reading to the previously mentioned prezto's pull request is recommended.

Bits of my configuration are documented on my blog and available on my git repo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM