Skip to content

Commit

Permalink
Merge pull request ryanoasis#34 from dritter/dritter/multiline_rpromp…
Browse files Browse the repository at this point in the history
…t_fix

Put RPROMPT on first line of dual-lined prompts.
  • Loading branch information
bhilburn committed Jun 5, 2015
2 parents 77cbe9a + 3e41f29 commit f7cb946
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion powerlevel9k.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f7cb946

Please sign in to comment.