zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: completion matching
Date: Fri, 13 Oct 2000 10:41:52 +0200 (MET DST)	[thread overview]
Message-ID: <200010130841.KAA00060@beta.informatik.hu-berlin.de> (raw)


Playing with what Jay described in his last message showed two bugs in 
the completion matching code:

With his directory structure, `u/q/a<TAB>' removed the `q/'. That was
caused by a wrong path-prefix matching.

And `../com/cor' with the cursor on the first `c' inserted something
funny (`C', `om' and `pletion', but in reverse order). This was caused 
by giving the wrong value to the `suffix' argument of add_match_str()
in two places.

Bye
 Sven

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.26
diff -u -r1.26 compmatch.c
--- Src/Zle/compmatch.c	2000/10/10 13:37:31	1.26
+++ Src/Zle/compmatch.c	2000/10/13 08:38:26
@@ -498,7 +498,7 @@
 	 */
 
 	bslash = 0;
-	if (!sfx && lw &&
+	if (!sfx && lw && (!part || test) &&
 	    (l[ind] == w[ind] ||
 	     (bslash = (lw > 1 && w[ind] == '\\' &&
 			(ind ? (w[0] == l[0]) : (w[1] == l[0])))))) {
@@ -784,10 +784,10 @@
 		    /* Probably add the matched strings. */
 		    if (!test) {
 			if (sfx)
-			    add_match_str(NULL, NULL, w, ow - w, 0);
+			    add_match_str(NULL, NULL, w, ow - w, sfx);
 			else
-			    add_match_str(NULL, NULL, ow, w - ow, 0);
-			add_match_str(mp, tl, tw, mp->wlen, 0);
+			    add_match_str(NULL, NULL, ow, w - ow, sfx);
+			add_match_str(mp, tl, tw, mp->wlen, sfx);
 			if (sfx)
 			    add_match_sub(NULL, NULL, 0, w, ow - w);
 			else
@@ -846,7 +846,7 @@
 	    if (!lw)
 		break;
 
-	    if (exact) {
+	    if (exact && !part) {
 		/* If we just accepted some characters directly (at the
 		 * beginning of the loop) and now can't match any further,
 		 * we go back to before those characters and try again,

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-10-13  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-13  8:41 Sven Wischnowsky [this message]
2000-10-13 16:47 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-10-16 10:33 Sven Wischnowsky
2000-06-19 10:46 Sven Wischnowsky

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=200010130841.KAA00060@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).