You are not logged in.

#1 2008-02-17 10:30:42

Ibex
Member
Registered: 2006-03-02
Posts: 135

Weird terminal behavour

Hi all,

I have the problem that when I'm typing commands at the terminal prompt and the command's width is larger that the terminal's width, the characters are printed on the same line, instead of the following.

An example when I want to play an autofile using the [tab]-key to autocomplete my paths:

[kenneth@molniya ~]$ mplayer multimedia/audio/
\ In\ The\ Wrong\ Lane/layer multimedia/audio/TATU\ -\ 200\ Kmh\
\ In\ The\ Wrong\ Lane/05\ -\ Tatu\ -\ How\ soon\ is\ now\ .mp3

If I press enter on the last, everything is working.
This also happens when I'm not using autocompletion and type everything.

My .bashrc:

alias 'ls'='ls --color=auto'
alias 'cd..'='cd ..'
alias 'cp'='cp -i'
alias 'rm'='rm -i'
alias 'mv'='mv -i'
alias 'cal'='cal -m'
alias 'nano'='nano -w'
alias 'free'='free -m'

if [ -e /arch32 ] ; then
  PS1='[\e[1;33m\]32\e[m\]][\e[0;32m\]\u\e[m\]@\h \W]\$ '
else
  PS1='[\e[0;32m\]\u\e[m\]@\h \W]\$ '
fi

umask 077

test -n "$DISPLAY" && export TERM=Eterm
export OOO_FORCE_DESKTOP=gnome

I'm using Arch64 with X in combination with Eterm.


Regards,

Ibex

--Edit;

This happens even when I just type nonsens with no space (like lakusdhglfkajsdslfkasjdhflkasjdhfasdf) on the prompt. I start, when it should go to the seconds like, it starts to overwrite the first line, but when it sould be to the third line, it's going to the seconds line. So it seems like its the first linebreak that is being ignored...

Last edited by Ibex (2008-02-17 10:33:59)

Offline

#2 2008-02-17 10:43:28

neotuli
Lazy Developer
From: London, UK
Registered: 2004-07-06
Posts: 1,204
Website

Re: Weird terminal behavour

it likely has something to do with your PS1 lines, specifically the coloring. Here's what mine looks like:

PS1='\[\033[0;31m\][\u@\h \W]\$\[\033[m\] '

and I don't have this problem. However when I set my PS1 to one of yours, the problem appears.

I've always found the color escapes kind of screwy, play around with them.


The suggestion box only accepts patches.

Offline

#3 2008-02-17 10:52:59

neotuli
Lazy Developer
From: London, UK
Registered: 2004-07-06
Posts: 1,204
Website

Re: Weird terminal behavour

Ok well after a little looking around I solved it for you.

PS1='\[\e[0;32m\][\u\[\e[m\]@\h \W]\$ '

works correctly for your second prompt.

Why? Take a look at http://www.ibm.com/developerworks/linux … ip-prompt/ ,scroll down to escape sequences:

\[    This sequence should appear before a sequence of characters that don't move the cursor (like color escape sequences). This allows bash to calculate word wrapping correctly.
\]    This sequence should appear after a sequence of non-printing characters.

So basically what was happening was that the wrapping was happening way earlier than the end of the actual terminal, and it was messing things up. And this was due to the fact that it was counting non-displayed characters as part of the width since they were not enclosed in \[ \] in your old PS1 lines.


The suggestion box only accepts patches.

Offline

#4 2008-02-17 11:26:41

Ibex
Member
Registered: 2006-03-02
Posts: 135

Re: Weird terminal behavour

Indeed, I forgot the \[ before all colors. Thanks!

Offline

Board footer

Powered by FluxBB