From 37cbc9a02d16b1d152dcc2c6af51214d316639d3 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 26 May 2018 00:27:36 +0200 Subject: [PATCH] Fix RPROMPT placement This fixes #841 --- powerlevel9k.zsh-theme | 2 +- test/powerlevel9k.spec | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8f06866f..e201d35c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1740,7 +1740,7 @@ $(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')' fi if [[ "$POWERLEVEL9K_DISABLE_RPROMPT" != true ]]; then - RPROMPT='$RPROMPT_PREFIX%f%b%k$(build_right_prompt)%{$reset_color%}$RPROMPT_SUFFIX' + RPROMPT="${RPROMPT_PREFIX}"'%f%b%k$(build_right_prompt)%{$reset_color%}'"${RPROMPT_SUFFIX}" fi local NEWLINE=' diff --git a/test/powerlevel9k.spec b/test/powerlevel9k.spec index 5f6b6f27..4178a4f6 100755 --- a/test/powerlevel9k.spec +++ b/test/powerlevel9k.spec @@ -114,4 +114,23 @@ function testOverwritingIconsWork() { # rm -fr ~/$testFolder } +function testNewlineOnRpromptCanBeDisabled() { + POWERLEVEL9K_PROMPT_ON_NEWLINE=true + POWERLEVEL9K_RPROMPT_ON_NEWLINE=false + POWERLEVEL9K_CUSTOM_WORLD='echo world' + POWERLEVEL9K_CUSTOM_RWORLD='echo rworld' + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world) + POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_rworld) + + powerlevel9k_prepare_prompts + assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX) world  $(print_icon MULTILINE_LAST_PROMPT_PREFIX) rworld ' "$(print -P ${PROMPT}${RPROMPT})" + + unset POWERLEVEL9K_PROMPT_ON_NEWLINE + unset POWERLEVEL9K_RPROMPT_ON_NEWLINE + unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + unset POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS + unset POWERLEVEL9K_CUSTOM_WORLD + unset POWERLEVEL9K_CUSTOM_RWORLD +} + source shunit2/source/2.1/src/shunit2