Message: previous - next
Month: April 2012

konsole "Prompt Tip" incorrect (with patch - review and push)

From: "David C. Rankin" <drankinatty@...>
Date: Tue, 17 Apr 2012 17:36:53 -0500

  Here is a simple one for you. The 'tips' in konsole tips to set the prompt
incorrectly uses a 'close' instead of 'open' bracket following the 'e' and
incorrectly uses a ';' and omits the 'm' to terminate resetting the prompt
background and bold state. The tips contain 3 similar references in the form:

export PS1=$PS1"\[\e]0;\H:\w\a\]"

  This is wrong. It should be:

export PS1=$PS1"\[\e[0m\H:\w\a\]"

  Note the second bracket is backwards... should be


  Further, to properly reset the background and bold state of the prompt (and to
terminate non-printing characters) so that BASH can properly calculate prompt
length and spacing, you must use '\[\e0m' not \[\e]0; (note the semicolon) The
semicolon is used to separate the foreground/background colors not terminate the
reset... You can see the differences when you look at the bad/good prompts
stacked above/below each other:

export PS1=$PS1"\[\e]0;\H:\w\a\]"
export PS1=$PS1"\[\e[0m\H:\w\a\]"

  I've included a patch that fixes the existing 3 prompt tips and I have
included 2 additional prompt tips as well.

  Review, signoff and push. If you don't want the additional 2 tips, just trim
them from the patch. (I always like additional tips :)

(no I won't explain how I found this :)

David C. Rankin, J.D.,P.E.