You are not logged in.

#1 2008-05-20 18:17:17

Jack B
Member
Registered: 2006-06-27
Posts: 107
Website

[solved] Gnome-terminal problem - no newline on line wrap

I've been having some trouble with gnome-terminal. No matter what size it is, after typing about 50 characters (inc prompt), it wraps onto the beginning of the same line, over typing the prompt.  Like this:
I start typing:

[19:14:22 jack ~]$abcdefghijklmno

but when I continue:

FGHIJKL22 jack ~]$abcdefghijklmnopqrstuvwxyzABCDE

If I keep typing, it reaches the right hand side of the window (about 80 characters) and wraps OK, continuing on the next line.

Anyone ever seen this before? I've tried "pacman -Rscn"-ing gnome-terminal, and removing ~/.config/Terminal/ and ~/.gconf/apps/gnome-terminal/, then reinstalling the package, but to no avail.  I've also tried the "terminal" package, which seems to be a very similar program, and had the same problem.

Any suggestions welcomed.

Jack

edit: add [solved] to title

Last edited by Jack B (2008-05-20 19:30:07)

Offline

#2 2008-05-20 18:19:34

skymt
Member
Registered: 2006-11-27
Posts: 443

Re: [solved] Gnome-terminal problem - no newline on line wrap

This could be a problem with your prompt. Can you post the relevant part of your .bashrc?

Offline

#3 2008-05-20 19:11:47

Jack B
Member
Registered: 2006-06-27
Posts: 107
Website

Re: [solved] Gnome-terminal problem - no newline on line wrap

Thanks skymt, right first time.  I commented out my custom PS1, and used the standard arch one.  The problem disappeared.

The problematic prompt is:

PS1='\e[0;32m[\t \u\e[0;34m \W\e[0;32m]\e[0;32m\$\e[m'

(should produce [hh:mm:ss username directory]$ in green except for the directory, which is blue)

I'm guessing the colourcodes are probably to blame?
Jack

Offline

#4 2008-05-20 19:25:36

skymt
Member
Registered: 2006-11-27
Posts: 443

Re: [solved] Gnome-terminal problem - no newline on line wrap

Yeah, the colors are the problem. Bash makes you wrap non-printing characters in '\[' and '\]'. I've corrected the prompt for you.

PS1='\[\e[0;32m\][\t \u\[\e[0;34m\] \W\[\e[0;32m\]]\[\e[0;32m\]\$\[\e[m\]'

Offline

#5 2008-05-20 19:27:14

Jack B
Member
Registered: 2006-06-27
Posts: 107
Website

Re: [solved] Gnome-terminal problem - no newline on line wrap

The colour codes were indeed to blame.  The syntax "\e[0;32m" I found on a website somewhere is wrong, it should be "\[033\[0;32m\]"

Problem solved!

Edit: simu-post with skymt: I guess \e and \033 are equivalent, but the lack of \[...\] was the problem.
Thanks again.

Last edited by Jack B (2008-05-20 19:29:12)

Offline

Board footer

Powered by FluxBB