mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
fix(josh): escape % in branch name before computing branch_size
c90141e introduced %-escaping in the prompt string via ${branch//\%/%%}
but branch_size was still computed from the raw (unescaped) branch name.
For branch names containing %, branch_size underestimates the displayed
width by one per % character, shifting all right-side padding one space
too wide.
Move the escaping to immediately after git_current_branch so that
branch_size and the prompt string both use the escaped length.
This commit is contained in:
parent
df34d2b8d5
commit
6959b1b951
1 changed files with 2 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ function josh_prompt {
|
|||
prompt=" "
|
||||
|
||||
branch=$(git_current_branch)
|
||||
branch="${branch//\%/%%}"
|
||||
ruby_version=$(ruby_prompt_info)
|
||||
path_size=${#PWD}
|
||||
branch_size=${#branch}
|
||||
|
|
@ -31,7 +32,7 @@ function josh_prompt {
|
|||
prompt=" $prompt"
|
||||
done
|
||||
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} ${branch//\%/%%}"
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} ${branch}"
|
||||
|
||||
echo $prompt
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue