From: glepnir Date: Wed, 22 Jul 2026 20:08:06 +0000 (+0000) Subject: patch 9.2.0838: searchcount() returns wrong cached maxcount X-Git-Tag: v9.2.0838^0 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;p=thirdparty%2Fvim.git patch 9.2.0838: searchcount() returns wrong cached maxcount Problem: Cached searchcount() returns 'maxsearchcount' instead of the requested maxcount. Solution: return the remembered last_maxcount (glepnir) closes: #20701 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- diff --git a/src/search.c b/src/search.c index bcf168be02..4f3a5dd9ef 100644 --- a/src/search.c +++ b/src/search.c @@ -3309,7 +3309,7 @@ update_search_stat( stat->cnt = cnt; stat->exact_match = exact_match; stat->incomplete = incomplete; - stat->last_maxcount = p_msc; + stat->last_maxcount = last_maxcount; return; } last_maxcount = maxcount; diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index be0a460b71..82c706132f 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -2457,4 +2457,17 @@ func Test_incsearch_delimiter_ctrlg() call StopVimInTerminal(buf) endfunc +func Test_searchcount_maxcount_cached() + new + call setline(1, repeat(['foo'], 5)) + set maxsearchcount=99 + let @/ = 'foo' + call cursor(1, 1) + call searchcount(#{recompute: v:true, maxcount: 3}) + let r = searchcount(#{recompute: v:false, maxcount: 3}) + call assert_equal(3, r.maxcount) + set maxsearchcount& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index d463a17d81..07772b03f5 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 838, /**/ 837, /**/