Bug 224451

Summary: cursor flickers when bash PS1 contains a non-printing terminal title escape sequence
Product: [Fedora] Fedora Reporter: Rob Peters <rjpeters>
Component: gnome-terminalAssignee: Behdad Esfahbod <behdad>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-31 02:44:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rob Peters 2007-01-25 19:31:05 UTC
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
typed character.



Version-Release number of selected component (if applicable):

This applies to gnome-terminal 2.16.0.2.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.



How reproducible:

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:

term_title="\[\e]0;\H\a\]"
PS1="${term_title}# "

2. Start a new window or tab in gnome-terminal.

3. Type a few characters on the command line.



Actual results:

The cursor flickers back and forth between the typing insertion point and the
beginning of the line (where the escape sequence is inserted).



Expected results:

No cursor flicker.



Additional info:

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
new line.

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:

http://ubuntuforums.org/showthread.php?t=326323