erikw / tmux-powerline

⚡️ A tmux plugin giving you a hackable status bar consisting of dynamic & beautiful looking powerline segments, written purely in bash.
BSD 3-Clause "New" or "Revised" License
3.36k stars 508 forks source link

vcs_rootpath shows backslash with tilde #385

Closed xx4h closed 3 months ago

xx4h commented 3 months ago

The current implementation of vcs_rootpath.sh shows \~ instead of just ~.

This is due to ~ being handled differently in parameter substitution within double quotes on older bash (e.g. bash-3.2 like in macOS) as in recent versions.

While on newer bash versions the behaviour is the same, regardless if ~ being used in parameter substitution w/ or w/o double quotes ("${a/*/~}" or ${a/*/~}) and the ~ is expanded in both cases if not escaped with \, on the older bash version, it is only expanded w/o double quotes, but not w/ them.

This is why we need to change the following lines in vcs_rootpath.sh: