[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pressing esc twice then left arrow deletes last character
From: |
Chet Ramey |
Subject: |
Re: Pressing esc twice then left arrow deletes last character |
Date: |
Wed, 15 Jul 2009 16:01:18 -0400 |
User-agent: |
Thunderbird 2.0.0.22 (Macintosh/20090605) |
James Rowell wrote:
> Bash Version: 3.2
> Patch Level: 33
> Release Status: release
>
> Description:
> There are several ways to get this bug to appear, but they all
> involve being in vi-command-mode (set -o vi) after entering
> some text to the command line, then pressing
> escape twice, then using a left or right arrow key to move
> around at which point characters are deleted from the
> point of the cursor to the end of the line.
>
> Repeat-By:
This isn't really a bug. It's caused by the extra ESC, which results in
an unexpected keybinding being activated. I'm going to assume that, like
mine, your left arrow key expands to ^[[D (ESC, left bracket, D).
> - At the prompt type 0123456789
> - hit escape twice
The first ESC takes to to vi command mode, and its keymap. The second
introduces a multiple-key sequence, since `ESC' is bound to indirect
into a secondary keymap in vi-command mode's keymap.
> - press the left-arrow
The first escape is taken as the second character in the multi-key
sequence (ESC-ESC), which is unbound. The `[' is next, and it's
unbound. Then comes the `D', which is bound to its standard vi meaning:
delete from point to the end of the line.
> - the '9' will be deleted
and this is why.
> - press escape again
and do it again.
> - press left-arrow again
> - the '8' will be deleted
> - etc...
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/