From 1619df1c5d797c3b25fc3224e49cac358c7450f6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 27 Jul 2001 22:23:15 +0000 Subject: 15511: zcalc tweaks --- Functions/Misc/zcalc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Functions') diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 80a031a8b..503bcb94b 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -84,11 +84,13 @@ emulate -L zsh setopt extendedglob -local line latest base defbase match mbegin mend +local line latest base defbase match mbegin mend psvar integer num zmodload -i zsh/mathfunc 2>/dev/null +: ${ZCALCPROMPT="%1v> "} + # Supply some constants. float PI E (( PI = 4 * atan(1), E = exp(1) )) @@ -101,7 +103,8 @@ for (( num = 1; num <= $#; num++ )); do print "$num> $argv[$num]" done -while vared -chp "$num> " line; do +psvar[1]=$num +while vared -cehp "${(%)ZCALCPROMPT}" line; do [[ -z $line ]] && break # special cases # Set default base if `[#16]' or `[##16]' etc. on its own. @@ -134,6 +137,7 @@ while vared -chp "$num> " line; do # arrays always store scalars anyway. eval "latest=\$(( $base $line ))" argv[num++]=$latest + psvar[1]=$num print -- $latest fi line= -- cgit 1.4.1