summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2012-03-15 16:08:28 +0100
committerHugues Hiegel <hugues@hiegel.fr>2012-03-15 16:08:28 +0100
commit22790301b29a066aea05acb438d7d742a0a907e9 (patch)
tree199f5e323016967086aa06e52166e97bd9589363 /12_Prompts.zsh
parent14d73e9bc8d3880bdecc557e98406c47e241ee98 (diff)
parent60067df38b00e7b63b40c29209a9309d0d0e748d (diff)
Merge branch 'master' of git:zdotdir
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh17
1 files changed, 12 insertions, 5 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 391a7c7..f15f9be 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -77,6 +77,17 @@ __hbar()
fi
}
+__get_prompt_lines()
+{
+ local lines
+ lines=$( (__expand_text "$PS1 $@" ) | 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 "$@" | tr ';\n' '.;' | sed 's/^\(.*[^;]\)\(;*\)$/\2/' | wc -c ) ))
+
+ echo $lines
+}
+
preexec ()
{
__term_title "$2"
@@ -87,11 +98,7 @@ preexec ()
__hbar
__redefine_prompt
- 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 ) ))
+ local lines=$(__get_prompt_lines "$1")
tput sc
for i in {1..$lines} ; tput cuu1