diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2001-07-27 22:23:15 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2001-07-27 22:23:15 +0000 |
commit | 1619df1c5d797c3b25fc3224e49cac358c7450f6 (patch) | |
tree | dd3a04e8eebb63b7f5990f3bd2513e506836c00b /Functions | |
parent | 4da5c1b2e0ae1dce9c75c8c883c4eb0ae8528c53 (diff) | |
download | zsh-1619df1c5d797c3b25fc3224e49cac358c7450f6.tar.gz zsh-1619df1c5d797c3b25fc3224e49cac358c7450f6.tar.xz zsh-1619df1c5d797c3b25fc3224e49cac358c7450f6.zip |
15511: zcalc tweaks
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Misc/zcalc | 8 |
1 files changed, 6 insertions, 2 deletions
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= |