[Konsole-devel] non-printing escape sequences munge cursor position?

Phil Sackinger pasacki at sandia.gov
Thu Sep 25 16:46:05 UTC 2003


Hi,

Thanks for creating and maintaining konsole. All those warnings about
dragons in the xterm code didn't scare you enough, though:) I tried
searching the mail list archives and didn't get any quick hits on this,
so here it is:

I like to insert color-changing escape sequenses into my shell prompt,
(PS1 in bash). For example, the pwd is in one color, the time another,
the event still another (and I embed a newline in the prompt as well.)

Lately I've noticed that auto new line scrolling in konsole doesn't work
properly. It skips to the beginning of the line *before* I reach the 80
character terminal width. Also, it doesn't insert the newline and
appears to be overwriting the old line contents.

I suspect this has to do with the current cursor position not being
known properly because of the escape sequences in my prompt string.

Is this a bug, or am I doing something incorrectly?

TIA.

Attached is my PS1.

PS1="${c[9]}[${c[2]}\h ${c[6]}\w${c[9]}]\n\t ${c[1]}\! ${c[9]}\$ "

where an array variable "c" holds the color escape
sequence characters, the character between the
opening tick (') and the open square bracket ([) is ESC, (octal 033,
0x1b) character.

i=0
while test $i -lt 20 ; do
    c[$i]='['`expr $i + 30`'m'
    i=`expr $i + 1`
done
unset i 







More information about the konsole-devel mailing list