Commit: patch 9.2.1040: matchfuzzypos() can be improved

3 views
Skip to first unread message

Christian Brabandt

unread,
Sep 7, 2026, 4:15:15 PM (3 days ago) Sep 7
to vim...@googlegroups.com
patch 9.2.1040: matchfuzzypos() can be improved

Commit: https://github.com/vim/vim/commit/c0c3fbd9671419fd43f9be0b9e371ab945af703a
Author: Yasuhiro Matsumoto <matt...@gmail.com>
Date: Mon Sep 7 20:04:46 2026 +0000

patch 9.2.1040: matchfuzzypos() can be improved

Problem: matchfuzzypos() can be improved
Solution: Compute the uppercase character once per character in
has_match(), instead of repeating the conversion while
scanning each candidate (Yasuhiro Matsumoto).

closes: #21241

Signed-off-by: Yasuhiro Matsumoto <matt...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/fuzzy.c b/src/fuzzy.c
index db006be0f..08f86eb46 100644
--- a/src/fuzzy.c
+++ b/src/fuzzy.c
@@ -992,12 +992,13 @@ has_match(char_u *needle, char_u *haystack)
while (*n_ptr)
{
int n_char = mb_ptr2char(n_ptr);
+ int n_upper = MB_TOUPPER(n_char);
int found = FALSE;

while (*h_ptr)
{
int h_char = mb_ptr2char(h_ptr);
- if (h_char == n_char || h_char == MB_TOUPPER(n_char))
+ if (h_char == n_char || h_char == n_upper)
{
found = TRUE;
h_ptr += mb_ptr2len(h_ptr);
diff --git a/src/version.c b/src/version.c
index a36d127d5..7b789eaea 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1040,
/**/
1039,
/**/
Reply all
Reply to author
Forward
0 new messages