Prompt - cursor position - command history display problem

View: New views
3 Messages — Rating Filter:   Alert me  

Prompt - cursor position - command history display problem

by timerlenmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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-unknown-linux-gnu' -DCONF_VENDOR='unknown'
-DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2

uname output: Linux
cyclops4 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:47:07 EDT 2007 x86_64
x86_64 x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash
Version: 4.0

Patch Level: 28

Release Status: release

Description:

With
a color prompt, long directory names, and/or long command lines, scrolling
through the command history often causes the cursor to be in the wrong
position, the prompt to loose color and remnants of previous long commands
to remain on the line with short commands.

Repeat-By:

* This line is
placed in ~/.bashrc:

PS1='[e[31;2m]w$[e[0m] '

* A terminal window is
opened with system default parameters (xterm and gnome-terminal have the
same behavior).

* xwininfo indicates that its geometry is: 80x24-80-85
(the window width changes the prompt-cursor-command line behavior).

*The
following is one of many sequences that cause the problem.

* The following
commands have been executed (prompts are shown here as the text from first
character to the first $) :

~$ pwd|wc -c

14 (******* response to
command*********)

~$ mkdir -p
/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB/

~$
cd
/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB/

**********
Now Command History is Scrolled Back With Up Arrow.
Result:

/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB$
pwd|wc -cwd|wc -c

99 (******* response to command*********) ****Remnant of
another command line (above) --^


Re: Prompt - cursor position - command history display problem

by Chet Ramey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Timothy James Erlenmeyer wrote:

> Bash Version: 4.0
> Patch Level: 28
> Release Status: release
>
> Description:
>
> With
> a color prompt, long directory names, and/or long command lines, scrolling
> through the command history often causes the cursor to be in the wrong
> position, the prompt to loose color and remnants of previous long commands
> to remain on the line with short commands.
>
> Repeat-By:
>
> * This line is
> placed in ~/.bashrc:
>
> PS1='[e[31;2m]w$[e[0m] '

Please read the Bash FAQ, question E3.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@...    http://cnswww.cns.cwru.edu/~chet/



Re: Prompt - cursor position - command history display problem

by Chet Ramey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Timothy James Erlenmeyer wrote:

>
> 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-unknown-linux-gnu' -DCONF_VENDOR='unknown'
> -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
>
> uname output: Linux
> cyclops4 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:47:07 EDT 2007 x86_64
> x86_64 x86_64 GNU/Linux
>
> Machine Type: x86_64-unknown-linux-gnu
>
> Bash
> Version: 4.0
>
> Patch Level: 28
>
> Release Status: release
>
> Description:
>
> With
> a color prompt, long directory names, and/or long command lines, scrolling
> through the command history often causes the cursor to be in the wrong
> position, the prompt to loose color and remnants of previous long commands
> to remain on the line with short commands.
>
> Repeat-By:
>
> * This line is
> placed in ~/.bashrc:
>
> PS1='[e[31;2m]w$[e[0m] '

Thanks for the report.  My testing indicates that this has been fixed for
the next version of bash.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@...    http://cnswww.cns.cwru.edu/~chet/