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:
parent
136cc1e1b7
commit
ab8fe84a8c
3 changed files with 24 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue