zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: John Heatherington <jheatherington@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Regression affecting completion with NO_CASE_GLOB
Date: Thu, 2 Jun 2022 19:41:48 -0700	[thread overview]
Message-ID: <CAH+w=7aO_F8wjndjwYqrCf6Rx5Rp2esZe0xhVap2cYmYX2F=iQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YSbV09ZsdK9J9aT4jPgqS8u4Lq=AxQ=94D63k3U+ha5g@mail.gmail.com>

On Thu, Jun 2, 2022 at 7:34 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> There are two ways to go here:  Revert the pattern_match_equivalence()
> change and alter cfp_matcher_range() to add one to the index that it
> passes, or change the other two callers to decrement their indices by
> one.  I tested the latter and it works as expected, but I think the
> former might be the more sensible approach.

In fact pattern_match1() calls PATMATCHRANGE() and then returns ind+1,
whereas cfp_matcher_range() calls PATMATCHRANGE() and then uses ind
directly, so it's pretty clear that reverting and fixing
cfp_matcher_range() is the right way to go.

diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index bb8359f1d..56e5509a4 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -1319,7 +1319,7 @@ pattern_match_equivalence(Cpattern lp,
convchar_t wind, int wmtp,
     convchar_t lchr;
     int lmtp;

-    if (!PATMATCHINDEX(lp->u.str, wind, &lchr, &lmtp)) {
+    if (!PATMATCHINDEX(lp->u.str, wind-1, &lchr, &lmtp)) {
        /*
         * No equivalent.  No possible match; give up.
         */
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 59abb4cc4..77ccdebf7 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4383,7 +4383,7 @@ cfp_matcher_range(Cmatcher *ms, char *add)
                         * word pattern.
                         */
                        if ((ind = pattern_match_equivalence
-                            (m->word, ind, mt, addc)) != CHR_INVALID) {
+                            (m->word, ind+1, mt, addc)) != CHR_INVALID) {
                            if (ret) {
                                if (imeta(ind)) {
                                    *p++ = Meta;


  reply	other threads:[~2022-06-03  2:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  0:27 John Heatherington
2022-06-03  2:34 ` Bart Schaefer
2022-06-03  2:41   ` Bart Schaefer [this message]
2022-06-03  3:03     ` John Heatherington

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='CAH+w=7aO_F8wjndjwYqrCf6Rx5Rp2esZe0xhVap2cYmYX2F=iQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=jheatherington@gmail.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).