[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Screen Corruption when browsing Command History with Custom Prompt
From: |
Ashley Wilson |
Subject: |
Screen Corruption when browsing Command History with Custom Prompt |
Date: |
Tue, 9 Sep 2008 19:21:25 +1000 |
From: root
To: bug-bash@gnu.org,bash@packages.debian.org
Subject: Screen Corruption when browsing Command History with Custom Prompt
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 Ashley-Ubuntu 2.6.24-19-generic #1 SMP Wed Aug 20
22:56:21 UTC 2008 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 3.2
Patch Level: 39
Release Status: release
Description:
I'm using a custom prompt using ~/.bashrc, given below:
PS1="\n\e[0;31m\u: \w\n# \e[m"
When I browse the command history using the up/down arrow buttons,
some of the first few characters
get stuck to the prompt. However, if I move the cursor until it
reaches the position just after these characters,
I can type-in the command I want and it works - even though someone
who sees the screen later will wonder
how it did work.
For example, this is how my bash screen looks after I've run the ls
command:
root: /home/ash
# gedls
Desktop Documents Examples Music My Games Pictures Public
Templates Videos
root: /home/ash
#
It looks as if I've run a command 'gedls', whereas the first three
characters are left-overs from the 'gedit'
command I ran just before it. The output is exactly what I expect,
but I can't seem to delete the 'ged' from the
prompt.
Repeat-By:
Set a custom prompt using the PS1 variable as follows:
PS1="\n\e[0;31m\u: \w\n# \e[m"
Then, browse command history using up/down keys.
The issue appears when the newline (\n) characters and the coloring
sequences (\e[0;31m, \e[m) are used together
in the prompt.
- Screen Corruption when browsing Command History with Custom Prompt,
Ashley Wilson <=