summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2015-06-05 20:08:02 +0300
committerBen Hilburn <bhilburn@gmail.com>2015-06-05 20:08:02 +0300
commitf7cb946898d501a273b4e193910dd5cac6ac22f1 (patch)
treedde263daa2df09cf045f4e4e9c49be38566e975a
parent77cbe9a6f07a81602e47eeab107c34ba6c7b8990 (diff)
parent3e41f292236336b8b67d329a6c7d86fc8b072320 (diff)
Merge pull request #34 from dritter/dritter/multiline_rprompt_fix
Put RPROMPT on first line of dual-lined prompts.
-rw-r--r--powerlevel9k.zsh-theme10
1 files changed, 9 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index f65143a1..df0319c7 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -470,7 +470,15 @@ precmd() {
if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then
PROMPT='╭─%{%f%b%k%}$(build_left_prompt)
╰─ '
+ # The right prompt should be on the same line as the first line of the left prompt.
+ # To do so, there is just a quite ugly workaround: Before zsh draws the RPROMPT,
+ # we advise it, to go one line up. At the end of RPROMPT, we advise it to go one
+ # line down. See http://superuser.com/questions/357107/zsh-right-justify-in-ps1
+ RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up
+ RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down
else
PROMPT='%{%f%b%k%}$(build_left_prompt) '
+ RPROMPT_PREFIX=''
+ RPROMPT_SUFFIX=''
fi
-RPROMPT='%{%f%b%k%}$(build_right_prompt)%{$reset_color%}'
+RPROMPT=$RPROMPT_PREFIX'%{%f%b%k%}$(build_right_prompt)%{$reset_color%}'$RPROMPT_SUFFIX