bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bracketed paste mode breaks cooked mode's tab + backspace


From: Chet Ramey
Subject: Re: Bracketed paste mode breaks cooked mode's tab + backspace
Date: Mon, 29 Jan 2018 19:25:14 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

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    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]