From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26110 invoked from network); 13 Oct 2000 08:42:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Oct 2000 08:42:42 -0000 Received: (qmail 652 invoked by alias); 13 Oct 2000 08:41:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12995 Received: (qmail 645 invoked from network); 13 Oct 2000 08:41:55 -0000 Date: Fri, 13 Oct 2000 10:41:52 +0200 (MET DST) Message-Id: <200010130841.KAA00060@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: completion matching Playing with what Jay described in his last message showed two bugs in the completion matching code: With his directory structure, `u/q/a' 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