On Mon, 14 Apr 2014 04:56:00 -0700 (PDT)
Ben Fritz <[email protected]> wrote:

> > To reproduce:
> > Start vim, *quickly* type the keys: i<Esc>Om

ESC O is SS3

> > Expected result:
> > New line created above the current one with the letter 'm' in it
> > 
> > Actual result:
> > Hyphen inserted on current line
> > 
> > Also affects:
> > Letters j,k,n,o
> > j gives *, k gives +, m gives -, n gives ., o gives /

SS3 j/k/n/o are the codes XTerm and similar use for number keypad
symbols.

> > Vim version: 7.4 (as installed by Ubuntu 13.10)
> > Happens on my machine, my co-worker's machine, several VMs and to
> > some (not all) of the people I asked about it on IRC. Definitely
> > requires that the typing is done quickly. Causes me problems very
> > frequently because I write a lot of Perl and when I go to declare a
> > variable, I get "-y $foo" on the current line instead of "my $foo"
> > on the previous line.
> 
> This looks like you're using Vim in a terminal, and you are typing
> fast enough for Vim to interpret your keystrokes as terminal key
> codes.

This /once again/ is another fallout from my seemingly never-ending
point of "can Vim please use proper keyboard input handling instead of
stupid 1980s stuff"; whereupon an entire class of bug like this will
just disappear.

Specifically in this case, what vim /ought/ to do but doesn't, is set
the terminal into "8-bit" mode, using the S8C1T sequence. After doing
that, these keypad SS3 sequences will be sent using /only/ the SS3 byte
(0x8f) and never by Escape O. After doing this, vim will no longer need
to rely on stupid timing tricks (see ttimeout and friends), because any
received Escape (0x1b) byte will be a REAL <Escape> keypress and never
a sequence.

Please please Bram - please look into this. If you fix this, there's a
huge class of user-facing problems like this which will never again
surface.

-- 
Paul "LeoNerd" Evans

[email protected]
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS

Attachment: signature.asc
Description: PGP signature

Raspunde prin e-mail lui