From 88ed6d9d9bad971a5341a46361f9890bd14a37eb Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 2 Aug 2017 14:25:59 +0200 Subject: [PATCH] zsh: prompt: switch from ZLE_RPROMPT_INDENT=0 to %{ %} for bottom_right_suffix Apparently ZLE_RPROMPT_INDENT is a bit buggy on several prompts (e.g. iTerm2, virtual-terminal on linux, etc) since not only the most right space is removed as intended, but also the cursor is moved on to the right causing the last character of the prompt to be overwritten. This causes completion to be rather weird (some characters are drawn twice and some aren't at all). Fix: Use %{ .. %} with ${bottom_right_suffix} to tell the terminal the last symbols have a width of zero -> the most right space will be overdrawn and thus not shown. --- zsh/prompt.zsh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 0acc5d6..4a22f2d 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -2,10 +2,6 @@ # only show RPROMPT on the current prompt setopt transient_rprompt # only show the rprompt on the current prompt -# set RPROMPT_INDENT to zero in order to remove the useless space on the bottom -# right of the prompt. -ZLE_RPROMPT_INDENT=0 - # ===== set the prompt zshrc_prompt_precmd() { @@ -78,7 +74,8 @@ zshrc_prompt_precmd() { # suffix characters in first and second line local top_suffix="%F{cyan}${top_right_corner}%f" - local bottom_suffix="%F{cyan}${bottom_right_corner}%f" + # use %{ .. %} for bottom_right_corner to remove useless space after RPROMPT + local bottom_suffix="%F{cyan}%{${bottom_right_corner}%}%f" # combine them to create the prompt local top_left=""