diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-01 12:03:47 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-01 12:03:47 +0000 |
commit | 733a69b29f0b0c3d2ddca463a41bdd912379bc5e (patch) | |
tree | 65bc4282dda846e701691450320de90c07cf5e44 /runtime | |
parent | 4f501171f7ba8fe3d24c7e5bf5fcec5b5f246df1 (diff) |
patch 9.0.0980: the keyboard state response may end up in a shell commandv9.0.0980
Problem: The keyboard state response may end up in a shell command.
Solution: Only request the keyboard protocol state when the typeahead is
empty, no more commands are following and not exiting. Add the
t_RK termcap entry for this.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/map.txt | 16 | ||||
-rw-r--r-- | runtime/doc/term.txt | 7 |
2 files changed, 19 insertions, 4 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e0c7106644..3f4a37190f 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1001,10 +1001,15 @@ mapping, see |map-bar|. WARNING: if you map <C-[> you may very well break any key codes that start with Esc. Make sure it comes AFTER other mappings. -Vim automatically detects if the modifyOtherKeys mode was enabled when it -spots an escape sequence that must have been created by it. To see if Vim -detected such an escape sequence use `:verbose map`, the first line will then -show "Seen modifyOtherKeys: true" (possibly translated). +Starting with xterm version 377 Vim can detect the modifyOtherKeys state by +requesting it. For this the 't_RK' termcap entry is used. When the response +is found then Vim will know whether modifyOtherKeys level 2 is enabled, and +handle mappings accordingly. + +Before version 377 Vim automatically detects if the modifyOtherKeys mode was +enabled when it spots an escape sequence that must have been created by it. +To see if Vim detected such an escape sequence use `:verbose map`, the first +line will then show "Seen modifyOtherKeys: true" (possibly translated). This automatic detection depends on receiving an escape code starting with "<1b>[27;". This is the normal way xterm sends these key codes. However, if @@ -1016,6 +1021,9 @@ after the CTRL-V key. This can be used to check whether modifyOtherKeys is enabled: In Insert mode type CTRL-SHIFT-V CTRL-V, if you get one byte then modifyOtherKeys is off, if you get <1b>[27;5;118~ then it is on. +Note that xterm up to version 376 has a bug that makes Shift-Esc send a +regular Esc code, the Shift modifier is dropped. + When the 'esckeys' option is off, then modifyOtherKeys will be disabled in Insert mode to avoid every key with a modifier causing Insert mode to end. diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 2bd83c7125..77d1ed388a 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -90,6 +90,11 @@ Note: When 't_ti' is not empty, Vim assumes that it causes switching to the alternate screen. This may slightly change what happens when executing a shell command or exiting Vim. To avoid this use 't_TI' and 't_TE'. +Vim will try to detect what keyboard protocol the terminal is using with the +'t_RK' termcap entry. This is sent after 't_TI', but only when there is no +work to do (no typeahead and no pending commands). That is to avoid the +response to end up in a shell command or arrive after Vim exits. + *xterm-bracketed-paste* When the 't_BE' option is set then 't_BE' will be sent to the terminal when entering "raw" mode and 't_BD' when leaving "raw" mode. The @@ -388,6 +393,8 @@ Added by Vim (there are no standard codes for these): xterm and other terminal emulators) The response is stored in |v:termresponse| |xterm-8bit| |'ttymouse'| |xterm-codes| + t_RK request terminal keyboard protocol state; *t_RK* *'t_RK'* + sent after |t_TI| t_u7 request cursor position (for xterm) *t_u7* *'t_u7'* see |'ambiwidth'| The response is stored in |v:termu7resp| |