Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 224451 - cursor flickers when bash PS1 contains a non-printing terminal title escape sequence
Summary: cursor flickers when bash PS1 contains a non-printing terminal title escape s...
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-terminal
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Behdad Esfahbod
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2007-01-25 19:31 UTC by Rob Peters
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-01-31 02:44:31 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
GNOME Bugzilla 346554 None None None Never

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, 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:

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:

Note You need to log in before you can comment on or make changes to this bug.