Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

matching right anchor on right



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



Messages sorted by: Reverse Date, Date, Thread, Author