zsh-workers
 help / color / mirror / code / Atom feed
* matching right anchor on right
@ 2015-09-21 21:55 Han Pingtian
  2015-09-22  1:06 ` Bart Schaefer
  2015-09-22  9:19 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Han Pingtian @ 2015-09-21 21:55 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: matching right anchor on right
  2015-09-21 21:55 matching right anchor on right Han Pingtian
@ 2015-09-22  1:06 ` Bart Schaefer
  2015-09-22  9:19 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2015-09-22  1:06 UTC (permalink / raw)
  To: zsh-workers

On Sep 22,  5:55am, Han Pingtian wrote:
} 
} I cannot understand these code in match_str() and think it should be
} written like this?

If you've gotten as far as believing you understand what's going on
there, you're farther along than anyone else since about 2003.  Go
for it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: matching right anchor on right
  2015-09-21 21:55 matching right anchor on right Han Pingtian
  2015-09-22  1:06 ` Bart Schaefer
@ 2015-09-22  9:19 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2015-09-22  9:19 UTC (permalink / raw)
  To: zsh-workers

On Tue, 22 Sep 2015 05:55:23 +0800
Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> 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:

I've committed this, 36538 and 36545 --- please let me know if there are any
I've forgotten.

Thanks
pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-22  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 21:55 matching right anchor on right Han Pingtian
2015-09-22  1:06 ` Bart Schaefer
2015-09-22  9:19 ` Peter Stephenson

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).