mirror of
git://git.code.sf.net/p/zsh/code
synced 2026-01-06 09:41:07 +01:00
two more fixes for completion matching and reporting interesting positions (13349)
This commit is contained in:
parent
25900ecf28
commit
4a39b5d9c5
3 changed files with 25 additions and 7 deletions
|
|
@ -1,5 +1,8 @@
|
|||
2001-01-15 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 13349: Src/Zle/compmatch.c, Src/Zle/compresult.c: two more fixes
|
||||
for completion matching and reporting interesting positions
|
||||
|
||||
* Ulrik Haugen: 13344, 13347: Completion/User/_grep,
|
||||
Completion/User/_ls, Completion/User/_use_lo: add completion for
|
||||
ls and ([ef]|)grep
|
||||
|
|
|
|||
|
|
@ -1133,16 +1133,16 @@ bld_parts(char *str, int len, int plen, Cline *lp)
|
|||
Cmlist ms;
|
||||
Cmatcher mp;
|
||||
int t, op = plen;
|
||||
char *p = str;
|
||||
char *p = str, *os = str;
|
||||
|
||||
while (len) {
|
||||
for (t = 0, ms = bmatchers; ms && !t; ms = ms->next) {
|
||||
mp = ms->matcher;
|
||||
if (mp && mp->flags == CMF_RIGHT && mp->wlen < 0 &&
|
||||
!mp->llen && len >= mp->ralen + mp->lalen && mp->ralen &&
|
||||
if (mp && mp->flags == CMF_RIGHT && mp->wlen < 0 && mp->ralen &&
|
||||
!mp->llen && len >= mp->ralen && (str - os) >= mp->lalen &&
|
||||
pattern_match(mp->right, str, NULL, NULL) &&
|
||||
(!mp->lalen ||
|
||||
((str - p) >= mp->lalen &&
|
||||
((str - os) >= mp->lalen &&
|
||||
pattern_match(mp->left, str - mp->lalen, NULL, NULL)))) {
|
||||
int olen = str - p, llen;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue