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

Phil Sackinger pasacki at sandia.gov
Fri Oct 3 19:42:34 UTC 2003


On Fri, 2003-09-26 at 04:47, Waldo Bastian wrote:

> > 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.
> 
> bash internally keeps track of where it thinks that your cursor is. These 
> escape sequences may confuse bash. Can you compare the behavior in konsole 
> with that in xterm?

Sure enough. The bash manual clearly states that its readline module
depends upon keeping track of character position.

Putting each color-changing escape sequence between a \[ and \] in PS1
fixed the problem, as this posting indicated.

http://mail.gnu.org/archive/html/bug-bash/2001-03/msg00007.html







More information about the konsole-devel mailing list