about summary refs log tree commit diff
path: root/Functions/Prompts/prompt_bart_setup
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-04-11 22:25:27 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-04-11 22:25:27 +0000
commit9e3017721e1cb30e633f0354cda61730443b873b (patch)
treea082a2d135b36f3b5d033cc54c52f6dc059a59df /Functions/Prompts/prompt_bart_setup
parenta8e2e327d12fed53343c2629050f16f198df10b1 (diff)
downloadzsh-9e3017721e1cb30e633f0354cda61730443b873b.tar.gz
zsh-9e3017721e1cb30e633f0354cda61730443b873b.tar.xz
zsh-9e3017721e1cb30e633f0354cda61730443b873b.zip
Strip %[BSubsu] as well as %{*%} before computing width of prompt.
Diffstat (limited to 'Functions/Prompts/prompt_bart_setup')
-rw-r--r--Functions/Prompts/prompt_bart_setup12
1 files changed, 6 insertions, 6 deletions
diff --git a/Functions/Prompts/prompt_bart_setup b/Functions/Prompts/prompt_bart_setup
index 8bc02a416..642fe9145 100644
--- a/Functions/Prompts/prompt_bart_setup
+++ b/Functions/Prompts/prompt_bart_setup
@@ -59,6 +59,7 @@ prompt_bart_help () {
 
 prompt_bart_precmd () {
     setopt localoptions noxtrace noksharrays
+    local zero='%([BSUbsu]|{*%})'
 
     # Using psvar here protects against unwanted promptsubst expansions.
 
@@ -67,11 +68,10 @@ prompt_bart_precmd () {
 
     # Compute the size of the upper left prompt and set psvar[9] if needed.
     psvar[9]=()
-    ((${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]} > COLUMNS-2)) && psvar[9]=''
-    : ${(S)PS1//[%]\{*%\}/}		# Bug workaround, up to 4.0.1-pre-3
+    ((${#${(f)${(%%)${(S)PS1//$~zero/}}}[1]} > COLUMNS-1)) && psvar[9]=''
 
     # Compute and set the padding between upper left and right prompts.
-    psvar[8]=${(l:COLUMNS-${#${(f)${(%%)${(S)PS1//[%]\{*%\}/}}}[1]}-1:: :)}
+    psvar[8]=${(l:COLUMNS-${#${(f)${(%%)${(S)PS1//$~zero/}}}[1]}-1:: :)}
 }
 
 prompt_bart_ps1 () {
@@ -96,14 +96,14 @@ prompt_bart_ps1 () {
 
     # Assemble the new prompt
     ps1=( ${(f)PS1} )		# Split the existing prompt at newlines
-    ps1=( "%$[COLUMNS-3]>..>"	# Begin truncation (upper left prompt)
+    ps1=( "%$[COLUMNS-1]>..>"	# Begin truncation (upper left prompt)
 	"$host"
 	"$hist1"		# Empty when too wide for one line
 	"$dir"
 	"%<<"			# End truncation (end upper left prompt)
 	"$space"		# Pad line to upper right position
-	"%$[COLUMNS-16](l.  . $date)"
-	"%$[COLUMNS-6](l.. $time)"
+	"%$[COLUMNS-16](l. . $date)"
+	"%$[COLUMNS-8](l.. $time)"
 	"$hist2"		# Empty when $hist1 is not empty
 	$'\n'
 	$ps1[-1] )		# Keep last line of the existing prompt