Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: When GLOB_COMPLETE is on, tab completion does not work with path containing hyphens
On Mon, 2019-12-09 at 09:29 +0000, Daniel Shahaf wrote:
> Mikael Magnusson wrote on Mon, 09 Dec 2019 09:23 +00:00:
> >
> > On 12/9/19, Felix.Chen <felix.chen@xxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > % mkdir a-b
> > >
> > > % touch a-b/{c,d}
> > >
> > >
> > >
> > > Type 'ls a-b' without quotes and press tab multiple times, zsh will cycle
> > > through 'ls a-b/c' and 'ls a-b/d'.
> > >
> > > But if GLOB_COMPLETE is on, zsh only complete up to 'a-b/'.
> > Hi,
> >
> > It works fine here, are you using an old version of zsh? (current
> > version is 5.7.1)
> I can reproduce it in 'zsh -f' + 'setopt GLOB_COMPLETE' but can't
> reproduce it if I then run compinit, in current(ish) master.
Presuming this is this issue...
There may be more like this, comptcl-age completion doesn't get much
attention.
pws
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index f242e1b28..f86a7552c 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -3035,9 +3035,9 @@ sep_comp_string(char *ss, char *s, int noffs)
static void
makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
{
- int t, sf1, sf2, ooffs, um = usemenu, delit, oaw, gflags;
+ int t, sf1, sf2, ooffs, um = usemenu, delit, oaw, gflags, ccount;
int mn = mnum, ohp = haspattern;
- char *p, *sd = NULL, *tt, *s1, *s2, *os = dupstring(s);
+ char *p, *sd = NULL, *tt, *s1, *s2, *os = dupstring(s), *psrc, *pdst;
struct cmlist ms;
ccont |= (cc->mask2 & (CC_CCCONT | CC_DEFCONT | CC_PATCONT));
@@ -3178,7 +3178,15 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
/* Compute line prefix/suffix. */
lpl = offs;
lpre = zhalloc(lpl + 1);
- memcpy(lpre, s, lpl);
+ for (ccount = 0, psrc = s, pdst = lpre;
+ ccount < lpl;
+ ++ccount, ++psrc, ++pdst)
+ {
+ if (*psrc == Dash)
+ *pdst = '-';
+ else
+ *pdst = *psrc;
+ }
lpre[lpl] = '\0';
qlpre = quotename(lpre);
lsuf = dupstring(s + offs);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author