diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2013-03-15 20:15:10 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2013-03-15 20:15:10 +0000 |
commit | 136cc1e1b79ebc07f5deb630fea9d325276d077c (patch) | |
tree | ee76079e38ef997ad9dfb3d5d71b3faac25f36ba /Functions/Misc/zcalc | |
parent | a69f05b4cecb800c8d09c9ab94ef18d11ef275e8 (diff) | |
download | zsh-136cc1e1b79ebc07f5deb630fea9d325276d077c.tar.gz zsh-136cc1e1b79ebc07f5deb630fea9d325276d077c.tar.xz zsh-136cc1e1b79ebc07f5deb630fea9d325276d077c.zip |
31154: make zcalc understand continuation lines with a backslash
Diffstat (limited to 'Functions/Misc/zcalc')
-rw-r--r-- | Functions/Misc/zcalc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 3d44f20db..d78c35ed2 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -155,7 +155,17 @@ for (( num = 1; num <= $#; num++ )); do done psvar[1]=$num -while vared -cehp "${ZCALCPROMPT}" line; do +local prev_line cont_prompt +while vared -cehp "${cont_prompt}${ZCALCPROMPT}" line; do + if [[ $line = (|*[^\\])('\\')#'\' ]]; then + prev_line+=$line[1,-2] + cont_prompt="..." + line= + continue + fi + line="$prev_line$line" + prev_line= + cont_prompt= [[ -z $line ]] && break # special cases # Set default base if `[#16]' or `[##16]' etc. on its own. |