[Top][All Lists]

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

PROMPT_COMMAND causing strange cursor behavior

From: Martin Sebor
Subject: PROMPT_COMMAND causing strange cursor behavior
Date: Mon, 27 Apr 2015 11:26:42 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic uname output: Linux beacon 3.18.7-200.fc21.x86_64 #1 SMP Wed Feb 11 21:53:17 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.3
Patch Level: 33
Release Status: release

When the PROMPT_COMMAND variable is set to a command such a printf
it causes the cursor to jump to disappear or jump to the wrong
positions when typing text that spans more than physical terminal
line. The problem exists in at least Bash 4.2 and 4.3 (but likely
earlier versions as well).

1) Open a terminal window (either XTerm or GNOME Terminal) 80
   columns wide. (The exact width shouldn't matter.)
2) Either set the TERM variable to vt100 or xterm, or unset it.
   The setting doesn't eliminate the problem but tends to have
   a slightly different effect on how it manifests.
3) Set the PROMPT_COMMAND variable to a string such as
   "printf '123: '" and unset PS1 (the second part isn't
   necessary to reproduce the problem).
4) Observe the shell prompt and the cursor after the trailing
   space: "123: "
5) If using GNOME Terminal, type as many characters as necessary
   for the cursor to advance to the last column of the terminal
   window. Then type one more character and observe the cursor
   disappear. (It doesn't seem to disappear in XTerm.)
6) In either terminal proceed to type more characters. The line
   will wrap around, continuing in column 1. Before the cursor
   advances to line up with the first typed character on the
   line above, observe it jump to column 1.
7) Continue typing more characters and observe the text overwrite
   the previously typed and displayed characters.
8) Enter ctrl+a to move the cursor to the beginning of the typed
   line and observe it jump into the middle of the prompt instead
   to the beginning of the typed text.

reply via email to

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