Fix: Break prompt line when prompt is too long.

This commit is contained in:
2020-04-05 12:14:43 +02:00
parent 1a4b6a3863
commit c2c7a53bd0
+3 -3
View File
@@ -96,9 +96,9 @@ build_prompt() {
PROMPT+=$prompt_ext_text PROMPT+=$prompt_ext_text
# build prompt suffix # build prompt suffix
local prompt_nocolor=$(echo $PROMPT | perl -pe "s/%\{[^}]+\}//g") local prompt_nocolor=$(echo ${PROMPT} | perl -pe "s/%\{[^}]+\}//g")
local prompt_length=${#prompt_nocolor} local prompt_length=${#${(%)prompt_nocolor}}
if [[ $prompt_length -gt 40 ]]; then if [[ $prompt_length -gt 45 ]]; then
PROMPT+=$(prompt_segment cyan '\n%{\r%}⇒ ') PROMPT+=$(prompt_segment cyan '\n%{\r%}⇒ ')
else else
PROMPT+=$(prompt_segment cyan ' ⇒ ') PROMPT+=$(prompt_segment cyan ' ⇒ ')