[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

customizing PS1 environment var with colour escape codes breaks readline



I didn't know what package should i file this bug to (cterm, base-utils, ...) so i report it here and hope someone can suggest:

I like customizing my PC. In my console I use the following PS1 var:

PS1='\n\033[34;1m[\w]\033[0;34m\$ '
PS1=$PS1'\033[s\033[1;1f\033[37;47;1m\033[K Terminal: \033[2m\l\033[1m\033[;19fJobs: \033[2m\j\033[1m\033[;29fUser: \033[2m\u\033[1m\033[;45fHost: \033[2m\h\033[1m\033[;61f\d  \033[2m(\A)
\033[u'
PS1=$PS1'\033[0m'

It works fine, but the thing is that suing colour escape codes seems to break readline! I mean, if I use that PS1 variable, readline behaves strange.

Example:
1) Set PS1 to the above value.
2) Start xterm
3) fill the xterm prompt with a large line. For example, "echo this is a veeeery lage line which, haveing colour escape codes in PS1 environment variable, will break readline". This command will probably (if not, make it larger) wrap into several lines in the xterm window.
4) While typing, you might have noticed that, instead of wrapping down a new line, the first time it gets to the end of the window, it just continues on the same line, overwritting the existing characters.
5) In the same way, when going back in the xterm prompt history to get that command, it will always take a line less in space that what it should. This all becomes very anyoing when treating with large commands (such as compilation commands) which I have to change frequently and don't want to type all along again.
6) What's more, when you modify such large commands in the console prompt history, it will show characters which aren't really the ones you are editting.

I hope I made myself clear.

Greetings!



Reply to: