From 6dbc777536af9535a87847e20fe4d9d63753d124 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 12 Mar 2012 17:12:36 +0100 Subject: [Prompts] Takes into account empty new-lines at end of prompt input. --- 12_Prompts.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to '12_Prompts.zsh') diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 7448eb4..ec88067 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -90,6 +90,9 @@ preexec () local lines lines=$( (__expand_text "$PS1 $1" ) | sed "s/\\(.\{,$COLUMNS\}\\)/\\1\n/g" ) lines=$( echo "$lines" | sed -n '/^$/n;p' | wc -l ) + # Got number of empty lines at end of command, because they are screwed up above... + lines=$(( $lines + $( echo -n "$1" | tr ';\n' '.;' | sed 's/^\(.*[^;]\)\(;*\)$/\2/' | wc -c ) )) + tput sc # /TODO/ GET A WAY TO KNOW IF THERE HAVE BEEN AN HIST_BANG OR NOT... for i in {1..$lines} ; tput cuu1 -- cgit v1.2.3