Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt expansion: $((%)foo} != $(print -P $foo)



On Mar 20,  1:04pm, Sven Wischnowsky wrote:
} Subject: Re: Prompt expansion: $((%)foo} != $(print -P $foo)
}
} Bart Schaefer wrote:
} 
} > The order in which parameter expansion vs. prompt %x expansion takes place
} > appears to be reversed for ${(%)...} and $(print -P ...).
} 
} Err... that's what (%%) is for.

D'oh!  I should have remembered that ...

Index: Functions/Prompts/prompt_bart_setup
===================================================================
@@ -60,19 +60,10 @@
     psvar[8]="$history[$#history]"	# Use history text, not just number
     psvar[9]=''				# Padding before upper right prompt
 
-    if [[ -o promptsubst ]]
-    then
-	# This is a bug workaround; ${(%)...} mishandles promptsubst
-	repeat $[COLUMNS-${#${(%f)${${(e)PS1}//[%]\{[^%]#%\}/}}[1]}-1]
-	do
-	    psvar[9]="$psvar[9] "
-	done
-    else
-	repeat $[COLUMNS-${#${(%f)${PS1//[%]\{[^%]#%\}/}}[1]}-1]
-	do
-	    psvar[9]="$psvar[9] "
-	done
-    fi
+    repeat $[COLUMNS-${#${(%%f)${PS1//[%]\{[^%]#%\}/}}[1]}-1]
+    do
+	psvar[9]="$psvar[9] "
+    done
 }
 
 prompt_bart_ps1 () {

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author