diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-12-16 10:51:25 +0100 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-12-16 10:51:25 +0100 |
commit | 41c15a21599f16a802046f741ac26f80c30c7c31 (patch) | |
tree | 39ff6cc4b8a225db47d6279cd8d5a27408c38769 /themes | |
parent | 4b4cc9a4a57468218b25b10c21c1e6060f42544b (diff) | |
download | zsh-41c15a21599f16a802046f741ac26f80c30c7c31.tar.gz zsh-41c15a21599f16a802046f741ac26f80c30c7c31.tar.bz2 zsh-41c15a21599f16a802046f741ac26f80c30c7c31.zip |
fix(jonathan): fix top bar alignment with RPROMPT
Diffstat (limited to 'themes')
-rw-r--r-- | themes/jonathan.zsh-theme | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 48927f1db..11d799a84 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -1,4 +1,6 @@ function theme_precmd { + local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} )) + PR_FILLBAR="" PR_PWDLEN="" @@ -7,12 +9,12 @@ function theme_precmd { local pwdsize=${#${(%):-%~}} # Truncate the path if it's too long. - if (( promptsize + rubypromptsize + pwdsize > COLUMNS )); then - (( PR_PWDLEN = COLUMNS - promptsize )) + if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then + (( PR_PWDLEN = TERMWIDTH - promptsize )) elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then - PR_FILLBAR="\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" + PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" else - PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" + PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" fi } |