[Top][All Lists]

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

Colored prompt length is not correctly computed - UTF-8

From: Chris Jones
Subject: Colored prompt length is not correctly computed - UTF-8
Date: Sat, 04 Jul 2009 12:18:51 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux turki 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686 
Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

When retrieving a command from bash's history, emacs keybindings CTRL-E & CTRL-A
do not move the cursor to the end and beginning of the retrieved command.

CTRL+E moves the cursor to a point that is short of the end of command
CTRL+A moves the cursor to a point that is within the bash prompt

When the cursor is moved to a location within the prompt, an ensuing CTL+K
erases not only the retrieved command, but also the part of the prompt that is
to the right of the cursor.

This was first noticed on a debian "lenny" system running the default 3.2.39
version of bash running in a color xterm, but was later reproduced on ubuntu
9.04 with bash 3.2.48 in gnome terminal. 

This was also verified to happen on the linux console - kernel 2.6.26.


$ export PS1="\[\033[0;41m\][$(date +%T)][\u@\h:\w]\$\[\033[0m\] "

[11:47:48][cjns@turki:~]$ echo try as you may

(reverse-i-search)`may': echo try as you may
                                         ^          (cursor position)
[11:47:48][cjns@turki:~]$ echo try as you may
                                  ^                 (new cursor position)
[11:47:48][cjns@turki:~]$ echo try as you may
               ^                                    (cursor now in prompt)
                                                    (erases part of prompt)

Note, that this does not occur when doing the (reverse-i-search) on "echo",
"try", or "as" - it only occurs when searching for "you" or "may".


Not fixes, but either of the following corrects the problem:

1. Removing the escape sequences from the prompt.

2. Switching the locale from UTF-8 (en_US.UTF-8) to ISO-8859-1 (en_US.iso88591).

reply via email to

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