patch 9.1.1395: search_stat not reset when pattern differs in case
Problem: search_stat not reset when pattern differs in case
(tahzibijafar)
Solution: use STRNCMP instead of MB_STRNICMP macro
There was a long standing todo comment, that using MB_STRNICMP is wrong.
So let's change it to STRNCMP() instead. Even if it not handle
multi-byte characters correctly, then Vim will rather recompute the
search stat, instead of re-using the old (and possibly wrong) value.
fixes: #17312
closes: #17314
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/search.c b/src/search.c
index ea7e654..14990e2 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3291,12 +3291,9 @@
|| (dirc == '/' && LT_POS(p, lastpos)));
// If anything relevant changed the count has to be recomputed.
- // MB_STRNICMP ignores case, but we should not ignore case.
- // Unfortunately, there is no MB_STRNICMP function.
- // XXX: above comment should be "no MB_STRCMP function" ?
if (!(chgtick == CHANGEDTICK(curbuf)
&& (lastpat != NULL
- && MB_STRNICMP(lastpat, spats[last_idx].pat, lastpatlen) == 0
+ && STRNCMP(lastpat, spats[last_idx].pat, lastpatlen) == 0
&& lastpatlen == spats[last_idx].patlen
)
&& EQUAL_POS(lastpos, *cursor_pos)