zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: When GLOB_COMPLETE is on, tab completion does not work with path containing hyphens
Date: Mon, 9 Dec 2019 10:21:43 +0000	[thread overview]
Message-ID: <1575886903.4486.4.camel@samsung.com> (raw)
In-Reply-To: <58e0a555-b3dc-4229-9d7d-371e96b915cb@www.fastmail.com>

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@3spocketnet.com.tw> 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);



  reply	other threads:[~2019-12-09 10:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09  1:19 Felix.Chen
2019-12-09  9:23 ` Mikael Magnusson
2019-12-09  9:29   ` Daniel Shahaf
2019-12-09 10:21     ` Peter Stephenson [this message]
2019-12-09 10:34       ` Peter Stephenson
2019-12-10  0:51   ` Felix Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1575886903.4486.4.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).