bug-bash
[Top][All Lists]
Advanced

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

Bracketed paste mode breaks cooked mode's tab + backspace


From: Egmont Koblinger
Subject: Bracketed paste mode breaks cooked mode's tab + backspace
Date: Mon, 29 Jan 2018 23:47:21 +0100

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/build/bash-IrsGKQ/bash-4.4=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-no-pie -Wno-parentheses -Wno-format-security
uname output: Linux blacky 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25
09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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.

    Here's the same story with iTerm2's shell integration from a
couple of years ago: https://gitlab.com/gnachman/iterm2/issues/3866 .


cheers,
egmont



reply via email to

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