| View previous topic :: View next topic |
| Author |
Message |
captwiggum n00b


Joined: 10 Mar 2006 Posts: 39 Location: Atlanta, Georgia, USA
|
Posted: Wed May 02, 2007 7:45 pm Post subject: SOLVED: gnome-terminal long bash lines do not edit correctly |
|
|
When I have long commnad lines that wrap, the line wraps to the beginning of the same line, rather than the next line. Similarly, when up-arrow'ing to previous long command lines, it prints the first half of the long line in place, then the next half on the previous line, rather than the next line. So and up-down-up-down arrow sequence steps the command line upward on my screen.
This happens with:
-both "set -o vi" and the default bash edit "set -o emacs"
-both TERM=xterm and TERM=vt220
-both gnome-terminal and rxvt (guess its not gnome-terminal specific)
I'm running the most current "stable make world" as of Apr-30. Gnome-terminal 2.16.1, xorg 7.2, etc. and a vanilla 2.6.20.7 kernel, on an x86, Dell Latitude D620 laptop.
Any ideas? Any help greatly appreciated. 
Last edited by captwiggum on Tue May 08, 2007 5:04 pm; edited 1 time in total |
|
| Back to top |
|
 |
di1bert l33t


Joined: 16 May 2002 Posts: 963 Location: Oslo, Norway
|
Posted: Mon May 07, 2007 2:58 pm Post subject: |
|
|
Hi captwiggum
I've done a little googling and it seems to be a problem with the PS1 variable.
Do you have a custom prompt ? Also what shell are you using ?
To check this do the following:
| Code: |
echo $PS1
echo $SHELL
|
The solution seemed to be to ensure that each of your escape sequences was
enclosed in a [ and ]. It's not related to Gentoo specifically but here was the
best explanation I found.
http://bbs.archlinux.org/viewtopic.php?pid=169030
HTH
-m _________________ choff. |
|
| Back to top |
|
 |
captwiggum n00b


Joined: 10 Mar 2006 Posts: 39 Location: Atlanta, Georgia, USA
|
Posted: Tue May 08, 2007 5:03 pm Post subject: Solved! |
|
|
Thanks di1bert! That link did not work for me in the literal sense, but the subject of discussion put me on the right track.
Basically, according to 'man bash', any non-printable characters in the prompt, such as escape sequences, must be enclosed within "\[" and "\]", with those backslashes included. Again, RTFM was the answer.
For example, my particular problem prompt, was this:
export PS1='\h:\033[1m\u\033[0m:\w:\$ '
The issue was that it looked fine and appeared to work. But long lines would not edit nice, as described above. The solution prompt was this:
export PS1='\h:\[\033[1m\]\u\[\033[0m\]:\w:\$ '
And it looks the same, but long lines now edit correctly!
Hope this helps others. Thanks again di1bert for taking the time to help. Rock on Gentoo! |
|
| Back to top |
|
 |
creidiki Apprentice


Joined: 23 Mar 2007 Posts: 283 Location: Varese (Italy)
|
Posted: Tue May 08, 2007 6:19 pm Post subject: |
|
|
interesting, did you report this to b.g.o?
edit: done it myself  _________________ '((eINIT) (soor overlay)) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|