From: Iain Patterson Date: Wed, 7 Dec 2011 13:38:49 +0000 (+0000) Subject: Make sure escape sequences don't leak into the prompt. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=4f25d8785934b70ae74c04e300041da947b728b5;p=profile.git Make sure escape sequences don't leak into the prompt. If some terminal formatting escape sequence was used by an application prior to returning to the prompt, the first parts of the prompt might not be drawn correctly. Force a reset before drawing anything. --- diff --git a/.profile.d/ps1.bashrc b/.profile.d/ps1.bashrc index 1d6c22b..528b49d 100644 --- a/.profile.d/ps1.bashrc +++ b/.profile.d/ps1.bashrc @@ -81,7 +81,7 @@ function __ps1() { # Default __ps1_user to 1. [ -z "$__ps1_user" ] && __ps1_user=1 - PS1='$(__ps1_user $? \u@)\[\033[$(__ps1_col $? 2>/dev/null)m\]$(__ps1_user $? \h)\[\033[$(__ps1_colour_escape $? $GIT_COLOUR)m\]$(__ps1_git $? 2>/dev/null)\[\033[0m\]\[\033[$(__ps1_colour_escape $? $P4_COLOUR)m\]$(__ps1_p4 $? 2>/dev/null)\[\033[0m\]\[\033[$(__ps1_colour_escape $? $SVN_COLOUR)m\]$(__ps1_svn $? 2>/dev/null)\[\033[0m\]$(__ps1_ret $? 2>/dev/null)$(__ps1_colon $?)\w\[\033[$(__ps1_root $? 2>/dev/null)m\]\$\[\033[0m\] ' + PS1='\[\033[0m\]$(__ps1_user $? \u@)\[\033[$(__ps1_col $? 2>/dev/null)m\]$(__ps1_user $? \h)\[\033[$(__ps1_colour_escape $? $GIT_COLOUR)m\]$(__ps1_git $? 2>/dev/null)\[\033[0m\]\[\033[$(__ps1_colour_escape $? $P4_COLOUR)m\]$(__ps1_p4 $? 2>/dev/null)\[\033[0m\]\[\033[$(__ps1_colour_escape $? $SVN_COLOUR)m\]$(__ps1_svn $? 2>/dev/null)\[\033[0m\]$(__ps1_ret $? 2>/dev/null)$(__ps1_colon $?)\w\[\033[$(__ps1_root $? 2>/dev/null)m\]\$\[\033[0m\] ' return 0 }