From c2c7a53bd0e93d0a76dac290c55df8136e700292 Mon Sep 17 00:00:00 2001 From: Marcel Schoengens Date: Sun, 5 Apr 2020 12:14:43 +0200 Subject: [PATCH] Fix: Break prompt line when prompt is too long. --- zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index ce4f26b..8ef7d32 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -96,9 +96,9 @@ build_prompt() { PROMPT+=$prompt_ext_text # build prompt suffix - local prompt_nocolor=$(echo $PROMPT | perl -pe "s/%\{[^}]+\}//g") - local prompt_length=${#prompt_nocolor} - if [[ $prompt_length -gt 40 ]]; then + local prompt_nocolor=$(echo ${PROMPT} | perl -pe "s/%\{[^}]+\}//g") + local prompt_length=${#${(%)prompt_nocolor}} + if [[ $prompt_length -gt 45 ]]; then PROMPT+=$(prompt_segment cyan '\n%{\r%}⇒ ') else PROMPT+=$(prompt_segment cyan ' ⇒ ')