about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Zsh/Context/_zcalc_line14
-rw-r--r--Functions/Misc/zcalc4
2 files changed, 8 insertions, 10 deletions
diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line
index 6ce3d82bf..76e5b4b25 100644
--- a/Completion/Zsh/Context/_zcalc_line
+++ b/Completion/Zsh/Context/_zcalc_line
@@ -22,7 +22,7 @@ _zcalc_line_escapes() {
 _zcalc_line() {
   local expl
 
-  if [[ CURRENT -eq 1 && $words[1] != ":!"* ]]; then
+  if [[ CURRENT -eq 1 && $words[1] != ":"(\\|)"!"* ]]; then
     local -a alts
     if [[ $words[1] = (|:*) ]]; then
       alts=("command-escapes:command escape:_zcalc_line_escapes")
@@ -35,15 +35,13 @@ _zcalc_line() {
   fi
 
   case $words[1] in
-    (":!"*)
-    if [[ $words[1] = ":!" ]]; then
+    (":"(\\|)"!"*)
+    if [[ $words[1] = ":"(\\|)"!" && CURRENT -gt 1 ]]; then
       shift words
-      (( CURRENT >1 && CURRENT-- ))
+      (( CURRENT-- ))
     else
-      words[1]=${words[1]##:\!}
-      if (( CURRENT == 1 )); then
-	compset -P ":\!"
-      fi
+      words[1]=${words[1]##:(\\|)\!}
+      compset -P ':(\\|)!'
     fi
     _normal
     ;;
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc
index 40c829900..42bb72e2c 100644
--- a/Functions/Misc/zcalc
+++ b/Functions/Misc/zcalc
@@ -179,9 +179,9 @@ while vared -cehp "${(%)ZCALCPROMPT}" line; do
   line="${${line##[[:blank:]]#}%%[[:blank:]]#}"
   case "$line" in
     # Escapes begin with a colon
-    (:(\\|)!*)
+    (:(\\|)\!*)
     # shell escape: handle completion's habit of quoting the !
-    eval ${line##:\![[:blank:]]#}
+    eval ${line##:(\\|)\![[:blank:]]#}
     line=
     continue
     ;;