From 6959b1b951c6a36cf790b350cbf15383ca5152eb Mon Sep 17 00:00:00 2001 From: kapilvus Date: Mon, 22 Jun 2026 23:51:47 +0530 Subject: [PATCH] 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. --- themes/josh.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index e8ae18dda..ead1fadfa 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -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 }