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.
This commit is contained in:
Thomas Preisner 2017-08-02 14:25:59 +02:00
parent 747085db67
commit 88ed6d9d9b

View file

@ -2,10 +2,6 @@
# only show RPROMPT on the current prompt # only show RPROMPT on the current prompt
setopt transient_rprompt # only show the 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 # ===== set the prompt
zshrc_prompt_precmd() { zshrc_prompt_precmd() {
@ -78,7 +74,8 @@ zshrc_prompt_precmd() {
# suffix characters in first and second line # suffix characters in first and second line
local top_suffix="%F{cyan}${top_right_corner}%f" 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 # combine them to create the prompt
local top_left="" local top_left=""