[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bind -m vi-insert '"jj": "\e"' problem in 4.4
From: |
Chet Ramey |
Subject: |
Re: bind -m vi-insert '"jj": "\e"' problem in 4.4 |
Date: |
Fri, 4 Nov 2016 12:16:32 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 11/4/16 6:36 AM, Clark Wang wrote:
> For example, in vi-insert mode I input following in the command line:
>
> # foo abc
>
> The cursor is right after 'c'. Now if I press ESC then it'll go to
> vi-command mode and the cursor will move to under 'c'. But if I press jj
> the cursor would be still after 'c' and if then I press h the cursor will
> skip 'c' and move to under 'b' . In 4.3, ESC and jj works the same so there
> must be something changed in 4.4. Please take a look.
What changed is not really what you would think. The key sequence you
have typed results in ESC, which is ambiguous: it's both a key binding
and a key prefix. Readline is waiting until you type an additional
character to resolve the ambiguity. For instance, if you were to type
`0' after this, readline would move the cursor to column 0 in vi
command mode.
There is special code in readline that uses a timeout to disambiguate for
the special case of ESC typed in vi insert mode. I will have to look
and see whether or not it makes sense to use that same timeout code for
a keyboard macro that resolves to ESC.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/