1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-26 16:40:29 +01:00

31155: minor extra zcalc features and documentation

This commit is contained in:
Peter Stephenson 2013-03-17 20:52:55 +00:00
parent 136cc1e1b7
commit ab8fe84a8c
3 changed files with 24 additions and 6 deletions

View file

@ -166,6 +166,14 @@ while vared -cehp "${cont_prompt}${ZCALCPROMPT}" line; do
line="$prev_line$line"
prev_line=
cont_prompt=
# Test whether there are as many open as close
# parentheses in the line so far.
if [[ ${#line//[^\(]} -gt ${#line//[^\)]} ]]; then
prev_line+=$line
cont_prompt="..."
line=
continue
fi
[[ -z $line ]] && break
# special cases
# Set default base if `[#16]' or `[##16]' etc. on its own.
@ -178,6 +186,7 @@ while vared -cehp "${cont_prompt}${ZCALCPROMPT}" line; do
defbase=$match[1]
fi
print -s -- $line
print -- $(( ${defbase} ans ))
line=
continue
else
@ -233,7 +242,7 @@ while vared -cehp "${cont_prompt}${ZCALCPROMPT}" line; do
continue
;;
((:|)function[[:blank:]]##(#b)([^[:blank:]]##)(|[[:blank:]]##([^[:blank:]]*)))
((function|:f(unc(tion|)|))[[:blank:]]##(#b)([^[:blank:]]##)(|[[:blank:]]##([^[:blank:]]*)))
zmathfuncdef $match[1] $match[3]
line=
continue