41c15a21599f16a802046f741ac26f80c30c7c31

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(jonathan): fix top bar alignment with RPROMPT

Diff

 1diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
 2index 48927f1db4d19d8126688b5ef950ca071a8f2605..11d799a84f3072ea048e326e01e57ff2bd721d7d 100644
 3--- a/themes/jonathan.zsh-theme
 4+++ b/themes/jonathan.zsh-theme
 5@@ -1,4 +1,6 @@
 6 function theme_precmd {
 7+  local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} ))
 8+
 9   PR_FILLBAR=""
10   PR_PWDLEN=""
11 
12@@ -7,12 +9,12 @@ function theme_precmd {
13   local pwdsize=${#${(%):-%~}}
14 
15   # Truncate the path if it's too long.
16-  if (( promptsize + rubypromptsize + pwdsize > COLUMNS )); then
17-    (( PR_PWDLEN = COLUMNS - promptsize ))
18+  if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then
19+    (( PR_PWDLEN = TERMWIDTH - promptsize ))
20   elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
21-    PR_FILLBAR="\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}"
22+    PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}"
23   else
24-    PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
25+    PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
26   fi
27 }
28