From 4a39b5d9c5e21d100a778e94f6c2936528967210 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 15 Jan 2001 10:44:14 +0000 Subject: two more fixes for completion matching and reporting interesting positions (13349) --- Src/Zle/compresult.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'Src/Zle/compresult.c') diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 55e37cd4a..f953e0f6b 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -249,7 +249,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl) /* Remember the position if this is the first prefix with * missing characters. */ if ((l->flags & CLF_MISS) && !(l->flags & CLF_SUF)) { - if (posl && l->min != l->max && (npos = cs + padd) != opos) { + if (posl && (npos = cs + padd) != opos) { opos = npos; addlinknode(posl, (void *) ((long) npos)); } @@ -303,7 +303,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl) if (l->flags & CLF_MID) mid = cs; else if (l->flags & CLF_SUF) { - if (posl && l->min != l->max && (npos = cs + padd) != opos) { + if (posl && (npos = cs + padd) != opos) { opos = npos; addlinknode(posl, (void *) ((long) npos)); } @@ -414,7 +414,13 @@ cline_str(Cline l, int ins, int *csp, LinkList posl) l = l->next; } if (posl && (npos = cs + padd) != opos) +#if 0 + /* This could be used to put an extra colon before the end-of-word + * position if there is nothing missing. */ + addlinknode(posl, (void *) ((long) -npos)); +#endif addlinknode(posl, (void *) ((long) npos)); + if (ins) { int ocs = cs; @@ -483,9 +489,18 @@ build_pos_string(LinkList list) LinkNode node; int l; char buf[40], *s; + long p; for (node = firstnode(list), l = 0; node; incnode(node)) { - sprintf(buf, "%ld", (long) getdata(node)); + p = (long) getdata(node); +#if 0 + /* This could be used to put an extra colon before the end-of-word + * position if there is nothing missing. */ + if (p < 0) + sprintf(buf, ":%ld", -p); + else +#endif + sprintf(buf, "%ld", p); setdata(node, dupstring(buf)); l += 1 + strlen(buf); } -- cgit 1.4.1