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

[PATCH] consider single dot as a valid (yet incomplete) parameter name



As I wrote in the previous post (54251),

% echo ${.<TAB>

offers nothing.

_complete_debug indicates that, at line 115 in _complete,
$compstate[context] = "command" instead of "brace_parameter".
This suggests that the problem is not in scripts but in C-code.

I came up with the following patch, but I'm not sure this is
the correct fix. Any comments?



diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index fb703f801..54e6146ad 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1240,6 +1240,15 @@ check_param(char *s, int set, int test)
 		    ie = itype_end(e, INAMESPC, 0);
 	    } while (ie != e);
 	}
+	else if (*e == '.')
+	    /*
+	     * *e == '.' and itype_end(e, INAMESPC, 0) == e.
+	     * This means the name starts with '.' followed by a
+	     * non-IIDENT char or by NULL. When completing, we can
+	     * consider the single '.' as a valid (but incomplete)
+	     * name and put the end of the name at e+1.
+	     */
+	    e++;
 
 	/* Now make sure that the cursor is inside the name. */
 	if (offs <= e - s && offs >= b - s) {







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