On Sat, 26 Oct 2013 21:50:57 +0200
Bram Moolenaar <[email protected]> wrote:

> How to detect the modifiers for many terminals in a portable way,
> without requiring installing an obscure library (at least Ubuntu must
> have it), I don't know.

Then let me explain it to you Bram; it's very simple.

All modified keys come in a CSI sequence, where the second numeric
argument encodes the modifiers.

  CSI P1; P2 u        ---  Modified Unicode character P1

  CSI  1; P2 [ABCDFH] ---  Modified Up/Down/Right/Left/End/Home
  CSI  1; P2 [PQRS]   ---  Modified F1/F2/F3/F4

  CSI P1; P2 ~        ---  Modified "function" key
      -- where the first few numbers encode
           2  Ins
           3  Del
           5  PageUp
           6  PageDown

In each case P2 encodes 1 + modifier state as a bitmask, 1 = Shift, 2 =
Alt, 4 = Ctrl; so 

   P2         1      unmodified
              2      S-
              3      A-
              4      A-S-
              5      C-
              6      C-S-
              7      C-A-
              8      C-A-S-

All is explained on

  http://www.leonerd.org.uk/hacks/fixterms/


I don't /actually/ care so much whether I can map Ctrl-Shift-I or not,
in vim; what I do care about is that vim understands THE BASIC PARSING
OF A CSI SEQUENCE and doesn't go "beep, leave insert mode, undo the
last 5 changes now" just because it got confused and saw a CSI nnn;5u
encoding of a Ctrl-letter sequence. So please; even if vim doesn't
do /anything/ with that modifier, I would like vim to be able to
RECOGNISE a CSI sequence, and know that it DOES NOT STOP until the
first character in the range 0x40-0x7e - no matter how many other
digits or other symbols were found first.

Without that, it means every single time my finger happens to slip and
I type some unrecognised Ctrl- sequence currently, I instantly leave
insert mode, undo the past 5 changes, and if I so much as press a
-single- extra key now I am likely to branch the undo history and
prevent my being able to "redo" those falsely-undone changes back in.
This is getting /incredibly/ frustrating.

-- 
Paul "LeoNerd" Evans

[email protected]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: PGP signature

Raspunde prin e-mail lui