Red Hat Bugzilla – Bug 224451
cursor flickers when bash PS1 contains a non-printing terminal title escape sequence
Last modified: 2007-11-30 17:11:54 EST
Description of problem:
When the bash PS1 prompt contains a non-printing escape sequence to set the
terminal window title, the cursor flickers -- with each character that is typed,
the cursor jumps to the beginning of the line (or to whichever location in the
prompt contains the invisible escape sequence), then back to the location of the
Version-Release number of selected component (if applicable):
This applies to gnome-terminal 188.8.131.52.fc6, both on x86-linux and ppc-linux. I
have also noticed the same problem with gnome-terminal from Fedora Core 5 and
possible FC4 (can't remember), but NOT with FC3 -- I just upgraded an x86-linux
machine from FC3 to FC6 and did not observe the problem before the upgrade, but
did have the problem after the upgrade.
100% consistent; I've observed the problem with multiple user accounts (trying
to rule out the possibility that some other config quirk in my personal account
is causing the problem).
Steps to Reproduce:
1. Add these lines to the end of ~/.bashrc so that PS1 gets set in this way:
2. Start a new window or tab in gnome-terminal.
3. Type a few characters on the command line.
The cursor flickers back and forth between the typing insertion point and the
beginning of the line (where the escape sequence is inserted).
No cursor flicker.
On the same machine, and with the same bash PS1 prompt, I can get flicker-FREE
prompting if I use either xterm or konsole, so it seems to be specific to
gnome-terminal rather than to bash, for example.
Also, the flickering problem seems to be specific to title-setting escape
sequences, since I am able to use other escape sequences (such as for
manipulating text color and bolding) without cursor flicker.
The problem seems to be related to the non-printing escape sequences "\[" and
"\]". If I remove those and just have the prompt contain "\e]0;\H\a", then the
terminal title is set properly and there is no cursor flicker, but line editing
is then messed up because the printable character count is wrong, so that the
cursor wraps back to the beginning of the line before actually scrolling to a
I've spent several hours on web-searches over the last couple years trying to
figure out whether I am doing something wrong, or to see if anyone else has
experienced this problem, or to see if there is a workaround. The only related
report I've seen is this one: