1e26ad1187cdee286d0332dbdffb6828a71140c2
Author Marc Cornellà <hello@mcornella.com> Committer Marc Cornellà <hello@mcornella.com> Date 2022-02-07 16:57 UTC
Message fix(bureau): fix top line space computation
Takes into account $ZLE_RPROMPT_INDENT and doesn't add the extra
space at the end so it doesn't bleed into the next line.
Diff 1 diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
2 index a5a8a2b2028339529929a85c93ad869974d0d498..698aa2ff8cbfd1eaa3d92005d03a1c863fefaa58 100644
3 --- a/themes/bureau.zsh-theme
4 +++ b/themes/bureau.zsh-theme
5 @@ -103,19 +103,14 @@ get_space () {
6 local STR=$1$2
7 local zero='%([BSUbfksu]|([FB]|){*})'
8 local LENGTH=${#${(S%%)STR//$~zero/}}
9 - local SPACES=""
10 - (( LENGTH = ${COLUMNS} - $LENGTH - 1))
11 + local SPACES=$(( COLUMNS - LENGTH - ${ZLE_RPROMPT_INDENT:-1} ))
12
13 - for i in {0..$LENGTH}
14 - do
15 - SPACES="$SPACES "
16 - done
17 -
18 - echo $SPACES
19 + (( SPACES > 0 )) || return
20 + printf ' %.0s' {1..$SPACES}
21 }
22
23 _1LEFT="$_USERNAME $_PATH"
24 -_1RIGHT="[%*] "
25 +_1RIGHT="[%*]"
26
27 bureau_precmd () {
28 _1SPACES=`get_space $_1LEFT $_1RIGHT`