From b3b0efb69f5b7817490aa9163ca44b40699b2bcc Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Sat, 28 Aug 2021 10:14:37 +0200 Subject: [PATCH] work around bugs in terminals and window managers by essentially disabling prompt_sp (but keeping prompt_cr) in instant prompt for new TTYs --- internal/p10k.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 46326f35..c50292f2 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -5906,7 +5906,7 @@ _p9k_set_instant_prompt() { [[ -n $RPROMPT ]] || unset RPROMPT } -typeset -gri __p9k_instant_prompt_version=41 +typeset -gri __p9k_instant_prompt_version=42 _p9k_dump_instant_prompt() { local user=${(%):-%n} @@ -6172,12 +6172,14 @@ _p9k_dump_instant_prompt() { fi typeset -g _p9k__ret=$x } - local out - if [[ $+VTE_VERSION == 0 && $TERM_PROGRAM != Hyper ]] || (( ! $+_p9k__g )); then + local out=${(%):-%b%k%f%s%u} + if [[ $P9K_TTY == old && ( $+VTE_VERSION == 0 && $TERM_PROGRAM != Hyper || $+_p9k__g == 0 ) ]]; then local mark=${(e)PROMPT_EOL_MARK} [[ $mark == "%B%S%#%s%b" ]] && _p9k__ret=1 || _p9k_prompt_length $mark local -i fill=$((COLUMNS > _p9k__ret ? COLUMNS - _p9k__ret : 0)) - out+="${(%):-%b%k%f%s%u$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}" + out+="${(%):-$mark${(pl.$fill.. .)}$cr%b%k%f%s%u%E}" + else + out+="${(%):-$cr%E}" fi if (( _z4h_can_save_restore_screen != 1 )); then (( height )) && out+="${(pl.$height..$lf.)}$esc${height}A"