2

I noticed konsole has problem to reset color on next page of scrolling, as screenshot below, run with command for i in {1..100}; do echo "$i"; echo -en '\033[1;42m AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \033[0m'; echo -e 'next text'; done; :

enter image description here

enter image description here

As you can see, the \033[0m get ignored started from 11th row which is the next page of current window view.

gnome-terminal no such issue., but I'm konsole user and looking for a solution to this.

[UPDATE]

I reported bug at https://bugs.kde.org/show_bug.cgi?id=409016

1

If you change

\033[0m

to

\033[0m\033[K

that will do what you intended. The difference is that when the terminal scrolls up, it will fill the new line with the current background color:

  • The \E[K clears the current line from the current position to the end of the line (undoing the color-filling done by scrolling).
  • The color behavior is a feature of Linux console, implemented in other terminals (rxvt, xterm, konsole).

See also:

  • A reminder to reader, this is uppercase 'K', can't use lowercase. – 林果皞 Jun 24 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.