From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23509 invoked from network); 23 Dec 2021 20:24:50 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Dec 2021 20:24:50 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1640291090; b=M2m2tJD3Vrq6rEsrLFqhZ6RmRdQ4B7H0hwdcVxLJCv1VgvKql9gQ+6PSyWnejZlVB7k15bIr79 VyqciKLzcB283mopEMJWIAQzZA7Irqmiif91V1oGE0xIInrtPkT5Se2i6XeYKXvyxSQY5f9Nzv b7joohBGAQzlMLhupJFrZGWfomwJZ7Oqu7GjGdXGNCCadn6w56hwdBlkJVbZ+y1/kwNXrbuW3D lY3w/hNyb7GcJhdJXpRfqVugeodIoafmzbdnTUHXJV+W0JOsc98RQgWiMNBMc/oZhmAdkl+dcZ qhQWd9qTfGApjCs7bLW5iPHVzEnulVINQYTmj4Ka/QN/8Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f42.google.com) smtp.remote-ip=209.85.222.42; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1640291090; bh=t33svBQGEKgxorE3laRGXh8GSRecZTiAVweG8ftfgmo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=Nr4XY+ANpdn4ymz++2vgvMR9ck7cR5tb+EaGTkfq6IeXE0odoY0pmkMuoCYLvgFcuchafbOHCl B8dgWxhvBERgzgzI+ykcBn1w3b6ph0BkkGZpJzYLQBwGK87yHPiMukVDyRM585K+F4BTnq2H83 d/SuOFyz5dASR0z+H6eJ6Fsv4FzsLGdEfR7AS5ZQloVGAr/JT5uAIBEnQg1h3wDvLmpqG66I46 0T9HuvwI+CUVlbMVz3kinNhXhEsYUxAqn/3EsflOmY/G/guhtuXMmulm28iqaMtTqV/mZRMM18 Onr9peHJGSE09vNdRVVS9n3f4riDIFs8k0UozUeE9jTZKg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=tj0tuGAfAdmtG2bAAuPqWSSQDmarv8rEXCLHxKTwGVE=; b=ILk0lzMf1wfkObffUsfpZBI4st AwEQ4NNx0R1uiIE/I/ZIJoJCgsMyX6OCv9JCczYyVJXQ6l0ZbiAPkESuoD1CJPeTGUqbycxmjTsJd CU0JUE5OvWCVc0ceGwPTO8W5HzVRv2xN7Lic5BV0XmcF+dO5W4o/eG2JDbbL2FY5TWaOLkYBOZ3Hd tesmkvNSGXH/l/bB0eKPrG+KWFF7uCPIrNApWt8j/n5MxK6EBabLue0VmFTZsg3dAskuTPZy3FzS3 TQiV27hxY4ZmlxEop5Jx84QnHWZAlt2zDv9u04Xsij+8tP9QjxRp7UAzZdBRfgb4XYiH5hYtdCR6C ugIyV3GA==; Received: from authenticated user by zero.zsh.org with local id 1n0Udt-000EZz-0L; Thu, 23 Dec 2021 20:24:49 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f42.google.com) smtp.remote-ip=209.85.222.42; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f42.google.com ([209.85.222.42]:40464) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1n0Udc-000EG3-Do; Thu, 23 Dec 2021 20:24:33 +0000 Received: by mail-ua1-f42.google.com with SMTP id v12so191351uar.7 for ; Thu, 23 Dec 2021 12:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tj0tuGAfAdmtG2bAAuPqWSSQDmarv8rEXCLHxKTwGVE=; b=R78zVHiwXa3UkynJ1HxRJZrNnG/7BkyUfH1hAUUwEdx4P1MhJkfWDDClO2pYP/XDS1 hA0kc2/FmS351id9ZGJmW+aGj8RSBQTYSVvM8jQfSSFZo8lWNH2QNRTDkGq/RIech0pd lN9oNlJNmYr8AOsXhpRVvsr+FUMOO4RLDrcMTixcSJDBM+cqP40B4jWpo2cFADZZ2yDv uXm9pxi597rJ0FMTgYPY2UeVoJ09LK9CTSeU1Pxd4f8/QP/no9SDO1QhGdDGP9AkkMO+ u5eYfeBN6ItuBsoPVdZRzYA1VfgH9UQBHt/nKrYhH44EiTtck+GQfmNfb5F4VrWeaaLU BVjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tj0tuGAfAdmtG2bAAuPqWSSQDmarv8rEXCLHxKTwGVE=; b=x+MX6hWh0EN6zofhCVYKLRtceeFFYb0E4ihaYILWRuJup+xaUxDI5uxL+YAPcHvQCu gPo4XxCPeB1QFIbc/lRyukDZJmsd8V+YW48E0wPM96thYu26xhud9Mut+8uP9qv80V4Y bf3ExWmdvE2YZQAKeFTnqHkfNXCafuLc1N16QT1o/QcRmwbeyDVJ7qvFFedLnaLCaKsf Lxr7waTcmvnJt03QPb0IITjFbo1mXVFY9/lesW7/cQY7D6h6/3ANLbDwvBlAnayZPph6 pKTE65NPhbgLX1rIqOHEwNwGGIcDtW+c5MSwXz/Fw+mb+rOlj4305nnbEHhvw+yCzCmx ls8Q== X-Gm-Message-State: AOAM532VA+maLiCx6XF5gNQ1CSBsouU3NJdbZ3EMmWZm9sC0DfRDnj2M 2IDmeI/h9lkcc9FDIaHeoLuHEnc5VyLFsrjPRBI= X-Google-Smtp-Source: ABdhPJyNkHjfkR/qjr9j5wRHoDnAHAVyclptH9FLZARbECzm4u5qUezh8z1jB0Jbu0NZYIiX9rfNyTKD3zCsPoMk6po= X-Received: by 2002:a67:cb91:: with SMTP id h17mr1295157vsl.35.1640291071017; Thu, 23 Dec 2021 12:24:31 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab0:37d5:0:0:0:0:0 with HTTP; Thu, 23 Dec 2021 12:24:30 -0800 (PST) In-Reply-To: <1457908574-11020-1-git-send-email-m0viefreak.cm@googlemail.com> References: <1457908574-11020-1-git-send-email-m0viefreak.cm@googlemail.com> From: Mikael Magnusson Date: Thu, 23 Dec 2021 21:24:30 +0100 Message-ID: Subject: Re: [PATCH] completion: matcher correspondence classes: fix offset To: m0viefreak Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 49661 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Were there ever any follwoups to this? I don't see any in the archive, and the code still has the -1. On 3/13/16, m0viefreak wrote: > The "compfiles" function passes the matcher through the > "cfp_matcher_range" function to turn a prefix into > character classes. Example: > > matcher: m:{a-z}={A-Z} > prefix: fo > file list: foo1.txt FOO2.txt > > the cfp_matcher_range function is supposed to turn the > prefix into: > > [fF][oO] > > However there is bug which causes the offset to shift > by 1. Without this patch it returns: > > [fE][oN] > > The bug was unnoticed before, because in the usual > case -- that is when matcher-list is set -- _path_files > calls compfiles -p ... "m:{a-z}={A-Z} m:{a-z}={A-Z}" > with the matcher added twice. This causes > "cfp_matcher_range" to do nothing at all, and instead > the whole list of files in the directory is returned. > Then it is filtered using compadd -D. > > A case where this bug surfaces is the following: > > Make sure no global matcher-list is set and set a single > matcher instead: > > zstyle -d ':completion:*' matcher-list > zstyle ':completion:*' matcher 'm:{a-z}={A-Z}' > > Now the completion > > cat fo > > only offers "foo1.txt" but not "FOO2.txt". > > Questions I couldn't anwswer, yet: > a) Why does "cfp_matcher_range" do nothing if more than > one matcher spec is given? > b) Do we even need the "cfp_matcher_range" function > at all? Seems like the later compadd -D works just > fine and we could remove a whole bunch of unneeded > functions that are only called from cfp_matcher_range. > c) Why does _path_files duplicate all matcher-list > entries when calling "compfiles -p"? > --- > Src/Zle/compmatch.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c > index 0e41ac3..667d71d 100644 > --- a/Src/Zle/compmatch.c > +++ b/Src/Zle/compmatch.c > @@ -1218,7 +1218,7 @@ pattern_match_equivalence(Cpattern lp, convchar_t > wind, int wmtp, > convchar_t lchr; > int lmtp; > > - if (!PATMATCHINDEX(lp->u.str, wind-1, &lchr, &lmtp)) { > + if (!PATMATCHINDEX(lp->u.str, wind, &lchr, &lmtp)) { > /* > * No equivalent. No possible match; give up. > */ > -- > 2.5.0.234.gefc8a62 > > -- Mikael Magnusson