Skip to content

Commit

Permalink
Fix line-wrapping problem (#47)
Browse files Browse the repository at this point in the history
The problem was caused by the symbol definitions, e.g. \xE2\x89\xA1 for the ≡ symbol. As per https://unix.stackexchange.com/a/468983/200655

Bash cannot calculate the length [of wide unicode symbols] correctly, so easiest way could be to escape 2 out of three parts of those wide symbols.

i.e. \[\xE2\x89\]\xA1
  • Loading branch information
MetRonnie committed Jul 30, 2020
1 parent 0a236e8 commit b4c4f47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions git-prompt.sh
Expand Up @@ -210,10 +210,10 @@ __posh_git_echo () {
local BranchBehindAndAheadStatusSymbol=''
local BranchWarningStatusSymbol=''
if $EnableStatusSymbol; then
BranchIdenticalStatusSymbol=$' \xE2\x89\xA1' # Three horizontal lines
BranchAheadStatusSymbol=$' \xE2\x86\x91' # Up Arrow
BranchBehindStatusSymbol=$' \xE2\x86\x93' # Down Arrow
BranchBehindAndAheadStatusSymbol=$'\xE2\x86\x95' # Up and Down Arrow
BranchIdenticalStatusSymbol=$' \[\xE2\x89\]\xA1' # Three horizontal lines
BranchAheadStatusSymbol=$' \[\xE2\x86\]\x91' # Up Arrow
BranchBehindStatusSymbol=$' \[\xE2\x86\]\x93' # Down Arrow
BranchBehindAndAheadStatusSymbol=$'\[\xE2\x86\]\x95' # Up and Down Arrow
BranchWarningStatusSymbol=' ?'
fi

Expand Down

0 comments on commit b4c4f47

Please sign in to comment.