Cleanup fuzzymatch();
This commit is contained in:
parent
4135cbc0f2
commit
c8e0d08302
26
libs/match.c
26
libs/match.c
|
@ -39,21 +39,19 @@ void fuzzymatch(void) {
|
||||||
pidx = 0; // pointer
|
pidx = 0; // pointer
|
||||||
sidx = eidx = -1; // start of match, end of match
|
sidx = eidx = -1; // start of match, end of match
|
||||||
|
|
||||||
// fuzzy match pattern
|
// walk through item text
|
||||||
if (matchregex(tx.text, it->text) && regex) {
|
for (i = 0; i < itext_len && (c = it->text[i]); i++) {
|
||||||
eidx = i;
|
if (!fstrncmp(&tx.text[pidx], &c, 1)) {
|
||||||
} else {
|
if(sidx == -1)
|
||||||
// walk through item text
|
sidx = i;
|
||||||
for (i = 0; i < itext_len && (c = it->text[i]); i++) {
|
pidx++;
|
||||||
if (!fstrncmp(&tx.text[pidx], &c, 1)) {
|
if (pidx == text_len) {
|
||||||
if(sidx == -1)
|
eidx = i;
|
||||||
sidx = i;
|
break;
|
||||||
pidx++;
|
|
||||||
if (pidx == text_len) {
|
|
||||||
eidx = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else if (matchregex(tx.text, it->text) && regex) {
|
||||||
|
eidx = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue