diff options
-rwxr-xr-x | bash-git-prompt.in | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/bash-git-prompt.in b/bash-git-prompt.in index e39ea81..0c06894 100755 --- a/bash-git-prompt.in +++ b/bash-git-prompt.in @@ -4,15 +4,11 @@ [[ "$TERM" = *color ]] && mitFarbe=true || mitFarbe=false -[ -z "$PS1Start" ] && [ -z "$PS1Ende" ] && - if echo "$PS1" | grep -q "\S" - then - export PS1Ende="$(echo "$PS1" | sed 's|^.*[^\]\(\\\?[$#>]\s*\([]\\[0-9m]\)*\s*\)$|\1|')" - export PS1Start="$(echo "$PS1" | sed 's|\\\?[$#>]\s*\([]\\[0-9m]\)*\s*$||')" - else - export PS1Ende="" - export PS1Start="$PS1" - fi +if [ -z "$PS1Start" ] && [ -z "$PS1Ende" ] && [ -n "$PS1" ] +then + export PS1Start="$(echo "$PS1" | sed 's@\(\\\[\\033\[[0-9]\+m\\]\|\s\)*\(\\\?\S\)\?\(\\\[\\033\[[0-9]\+m\\]\|\s\)*$@@')" + export PS1Ende="${PS1:${#a}}" +fi PS1="$PS1Start" |