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

Re: brace in alias name and compsys



On Sun, 15 Dec 2013 11:52:36 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> While we're on the subject, completing after "[" or "[[" in command
> position (no intervening whitespace) incorrectly attempts subscript
> completion.  This appears to be a bug somewhere in the internals,
> because compstate[context] has been set to 'subscript' and there's no
> assignment to that in _complete_debug output.

I think it's something like this.

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e30e0b1..6ed4a0e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1505,7 +1505,11 @@ get_comp_string(void)
 	else
 	    nnb = s;
 	for (tt = s; tt < s + zlemetacs_qsub - wb;) {
-	    if (*tt == Inbrack) {
+	    /*
+	     * Ignore '[' at the start of a command as it's not
+	     * matched by a closing bracket.
+	     */
+	    if (*tt == Inbrack && (tt != s || !lincmd)) {
 		i++;
 		nb = nnb;
 		ne = tt;

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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