diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2008-11-04 10:25:51 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2008-11-04 10:25:51 +0100 |
commit | 496fca4fed8c8ead99a31821195cf32609f000fb (patch) | |
tree | 570f15a5be4df620e366b938cb4e519478ebcc29 | |
parent | a5376da53040cc84cdfee2fd0293ad4d7e5a3334 (diff) |
Better calculation of command size
-rw-r--r-- | 12_Prompts.zsh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 79d0c0b..45a6085 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -37,9 +37,8 @@ preexec () prompt_colors[date]="$prompt_colors[generic];$color[bold]" update_prompt - local string="$(expand_text "$PROMPT$1")" - local lines=$(( (${#string} - 1) / $COLUMNS)) - for i in {0..$lines} ; print -Pn "\e[1A" + local lines="$(expand_text "$PROMPT$1" | sed "s/\\(.\{$COLUMNS\}\\)/\\1\\n/g" | wc -l)" + for i in {1..$lines} ; print -Pn "\e[1A" print -Pn "\r$PROMPT" print "$1" prompt_colors[date]=$prompt_colors[generic] |