zsh-workers
 help / color / mirror / code / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: zsh-workers@zsh.org
Subject: matching right anchor on right
Date: Tue, 22 Sep 2015 05:55:23 +0800	[thread overview]
Message-ID: <20150921215523.GA21203@localhost.localdomain> (raw)

Hi there,

I cannot understand these code in match_str() and think it should be
written like this? This make sure right anchor to be matched of the
right of command line and trail word substring.

Without the patch, this completion doesn't work:

% zsh -f
localhost% autoload init
localhost% autoload compinit
localhost% compinit
localhost% _foo()
function> compadd -M 'r:{A-Z}|.={a-z}' foo.bar
localhost% compdef _foo foo
localhost% foo foO.<tab>

after applying the patch, it works.
---
 Src/Zle/compmatch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 05ae43a..b090af6 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -813,10 +813,12 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
 			    continue;
 			else if (mp->right)
 			    t = pattern_match(mp->right,
-					      tl + mp->llen - mp->ralen,
+					      //tl + mp->llen - mp->ralen,
+					      tl + mp->llen,
 					      NULL, NULL) &&
 				pattern_match(mp->right,
-					      tw + mp->wlen - mp->ralen,
+					      //tw + mp->wlen - mp->ralen,
+					      tw + mp->wlen,
 					      NULL, NULL) &&
 				(!mp->lalen ||
 				 pattern_match(mp->left, tw + mp->wlen -
-- 
1.9.3


             reply	other threads:[~2015-09-21 22:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21 21:55 Han Pingtian [this message]
2015-09-22  1:06 ` Bart Schaefer
2015-09-22  9:19 ` Peter Stephenson

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=20150921215523.GA21203@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.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).