zsh-workers
 help / color / mirror / code / Atom feed
* Unquoted "-" tokenization broke glob_complete
@ 2019-01-03 12:07 ` Sam Hocevar
  2019-01-03 12:40   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Hocevar @ 2019-01-03 12:07 UTC (permalink / raw)
  To: zsh-workers

Commit f3f8537cfa05414ad14494e809d9ebfeef86ebbc [1] broke autocompletion
when a directory name contains a hyphen and glob_complete is active.

Simple repro:

    mkdir -p foo-/bar

    unsetopt glob_complete
    # This works
    echo foo-/b<TAB>

    setopt glob_complete
    # This fails
    echo foo-/b<TAB>
  
1: https://sourceforge.net/p/zsh/code/ci/f3f8537cfa05414ad14494e809d9ebfeef86ebbc/

-- 
Sam.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Unquoted "-" tokenization broke glob_complete
  2019-01-03 12:07 ` Unquoted "-" tokenization broke glob_complete Sam Hocevar
@ 2019-01-03 12:40   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2019-01-03 12:40 UTC (permalink / raw)
  To: zsh-workers

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);
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-03 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190103121454epcas3p4e581fa9f1880f6453e1696415bb459a4@epcas3p4.samsung.com>
2019-01-03 12:07 ` Unquoted "-" tokenization broke glob_complete Sam Hocevar
2019-01-03 12:40   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).