zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: unambiguous string heuristic
Date: Thu, 14 Oct 1999 10:51:46 +0200 (MET DST)	[thread overview]
Message-ID: <199910140851.KAA13538@beta.informatik.hu-berlin.de> (raw)


With a match spec such as `r:|.=*' and trying `Zle/zle_t<TAB>' one
gets `Zle/zle_t.' (note the dot). This patch avoids inserting such
small unambiguous anchors if there are characters missing before them
(and they are at the end of the string, inside words older code takes
care of them).

Bye
 Sven

diff -u oldsrc/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- oldsrc/Zle/zle_tricky.c	Thu Oct 14 08:43:42 1999
+++ Src/Zle/zle_tricky.c	Thu Oct 14 10:50:17 1999
@@ -7801,7 +7801,7 @@
 static Cline
 cut_cline(Cline l)
 {
-    Cline p, e = NULL, maxp = NULL;
+    Cline q, p, e = NULL, maxp = NULL;
     int sum = 0, max = 0, tmp, ls = 0;
 
     /* If no match was added with matching, we don't really know
@@ -7819,10 +7819,17 @@
     /* First, search the last struct for which we have something on
      * the line. Anything before that is kept. */
 
-    for (p = l; p; p = p->next)
+    for (q = NULL, p = l; p; p = p->next) {
 	if (p->orig || p->olen || !(p->flags & CLF_NEW))
 	    e = p->next;
-
+	if (!p->suffix && (p->wlen || p->llen || p->prefix))
+	    q = p;
+    }
+    if (!e && q && !q->orig && !q->olen && (q->flags & CLF_MISS) &&
+	(q->word ? q->wlen : q->llen) < 3) {
+	q->word = q->line = NULL;
+	q->wlen = q->llen = 0;
+    }
     /* Then keep all structs without missing characters. */
 
     while (e && !(e->flags & CLF_MISS))

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


                 reply	other threads:[~1999-10-14  8:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=199910140851.KAA13538@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).