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

Re: Unquoted "-" tokenization broke glob_complete



On Thu, 2019-01-03 at 13:07 +0100, Sam Hocevar wrote:
> Commit f3f8537cfa05414ad14494e809d9ebfeef86ebbc [1] broke autocompletion
> when a directory name contains a hyphen and glob_complete is active.

You're talking about old-fashioned completion when the shell comes up
raw (apart from GLOB_COMPLETE), without the completion system loaded,
right?

We've been gradually picking up these Dash problems for some time now.
It was added to be able to emulate sh pattern matching better, which is
irrelevant and (as you've found) occasionally annoying in native mode.
I'm seriously wondering if the right fix for such issues in the future
isn't simply to give up on complete compatibility for sh-style patterns
but just document the issues --- there are things that zsh really isn't
equipped to do.

pws

diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 87d13af..fe87409 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -3256,6 +3256,15 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	rpl = strlen(rpre);
 	rsl = strlen(rsuf);
     }
+    else
+    {
+	for (p = rpre; *p; ++p)
+	    if (*p == Dash)
+		*p = '-';
+	for (p = rsuf; *p; ++p)
+	    if (*p == Dash)
+		*p = '-';
+    }
     untokenize(lpre);
     untokenize(lsuf);
 



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