summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-09 14:15:58 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-03-09 15:16:36 +0100
commit286edca6a2971be3852be898ff9297ea8f672ad0 (patch)
treef7dd77379529d61f75fd2c05e6058f5f3bbda045 /12_Prompts.zsh
parent8ca053002b72e57f0e63a8e40144e39123a9280d (diff)
[Prompt] preexec : YAHAHAAAA !
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh11
1 files changed, 7 insertions, 4 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 7ec76fd..d96dd2e 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -57,8 +57,8 @@ chpwd()
__expand_text()
{
- # strips the %{...%} and newlines characters
- print -Pn -- "$(echo $@ | tr -d '\n' | sed 's/%{[^(%})]*%}//g;s/'$T_'//g;s/'$_T'//g')"
+ # strips the %{...%} and everything after \r characters
+ print -Pn -- "$(echo $@ | sed 's/\r.*//g;s/%{[^(%})]*%}//g;s/'$T_'//g;s/'$_T'//g')"
}
export _COLUMNS_OLD=0
@@ -87,11 +87,14 @@ preexec ()
__hbar
__redefine_prompt
- local lines="$(($( (__expand_text "$PROMPT";__expand_text "$1") | sed "s/\\(.\{0,$COLUMNS\}\\)/\\1\\n/g" | wc -l)))"
+ local lines
+ lines=$( (__expand_text "$PS1 $1" ) | sed "s/\\(.\{,$COLUMNS\}\\)/\\1\n/g" )
+ lines=$( echo "$lines" | sed -n '/^$/n;p' | wc -l )
tput sc
for i in {1..$lines} ; tput cuu1
- print -Pn "$PROMPT"
+ print -Pn "$PS1"
tput rc
+ #print -Pn $C_"30"$_C"-$(echo -n "$1" | wc -l)-> ${(q)1} <-"$lines"-\n"
print -Pn "$C_$_prompt_colors[exec]$_C"
}