Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SOLVED: gnome-terminal long bash lines do not edit correctly
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
captwiggum
n00b
n00b


Joined: 10 Mar 2006
Posts: 39
Location: Atlanta, Georgia, USA

PostPosted: Wed May 02, 2007 7:45 pm    Post subject: SOLVED: gnome-terminal long bash lines do not edit correctly Reply with quote

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. :oops:


Last edited by captwiggum on Tue May 08, 2007 5:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Mon May 07, 2007 2:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
captwiggum
n00b
n00b


Joined: 10 Mar 2006
Posts: 39
Location: Atlanta, Georgia, USA

PostPosted: Tue May 08, 2007 5:03 pm    Post subject: Solved! Reply with quote

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. :oops:

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
View user's profile Send private message
creidiki
Apprentice
Apprentice


Joined: 23 Mar 2007
Posts: 283
Location: Varese (Italy)

PostPosted: Tue May 08, 2007 6:19 pm    Post subject: Reply with quote

interesting, did you report this to b.g.o?

edit: done it myself :)
_________________
'((eINIT) (soor overlay))
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
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