Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] _regex_words: Don't add mismatched parentheses



I ran into this in the wild¹, it manifested as the following error message:

    zregexparse:4: not enough regex arguments

¹ https://bug.tasktools.org/browse/TW-1729
---

diff --git a/Completion/Base/Utility/_regex_words b/Completion/Base/Utility/_regex_words
index 77ba197..62c2491 100644
--- a/Completion/Base/Utility/_regex_words
+++ b/Completion/Base/Utility/_regex_words
@@ -20,7 +20,13 @@ local tag=$1
 local desc=$2
 shift 2
 
-reply=(\()
+if (( $# )); then
+  reply=(\()
+else
+  # ### Is this likely to happen in callers?  Should we warn?
+  reply=()
+  return
+fi
 
 integer i
 local -a wds



Messages sorted by: Reverse Date, Date, Thread, Author