about summary refs log tree commit diff
path: root/Src/Zle/zle_tricky.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_tricky.c')
-rw-r--r--Src/Zle/zle_tricky.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1aa..25f09c459 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1504,7 +1504,17 @@ get_comp_string(void)
 	    nnb = s + MB_METACHARLEN(s);
 	else
 	    nnb = s;
-	for (tt = s; tt < s + zlemetacs_qsub - wb;) {
+	tt = s;
+	if (lincmd)
+	{
+	    /*
+	     * Ignore '['s at the start of a command as they're not
+	     * matched by closing brackets.
+	     */
+	    while (*tt == Inbrack && tt < s + zlemetacs_qsub - wb)
+		tt++;
+	}
+	while (tt < s + zlemetacs_qsub - wb) {
 	    if (*tt == Inbrack) {
 		i++;
 		nb = nnb;