On 1/29/18 5:47 PM, Egmont Koblinger wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Hi,
> 
> Repeat-By:
>     "set enable-bracketed-paste on" in inputrc
> 
>     Start any simple (non-readline) command just as "cat".
> 
>     Press TAB, then press backspace.
> 
>     Expected behavior: The cursor should move back to the beginning of the 
> row.
> 
>     Actual behavior: The cursor moves back by 1 character.
> 
> Description:
>     What happens behind the scenes is: bash (readline) first emits the
> newline corresponding to the Enter keypress, and then disables
> bracketed paste mode by printing "\e[?2004l". These characters don't
> move the cursor in terminal emulators, but the Linux kernel's tty
> driver doesn't know this. It believes that the cursor has already
> advanced by 7 positions, and computes the tab + backspace behavior
> accordingly.
> 
> Fix:
>     Suggested solution: Either turn off bracketed paste before
> printing the newline, or emit yet another CR after turning off
> bracketed paste mode.

It seems like adding \r to the end of the sequence to turn off bracketed
paste mode should do the trick.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to