mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
vim-patch:9.2.0838: searchcount() returns wrong cached maxcount (#40913)
Problem: Cached searchcount() returns 'maxsearchcount' instead of the
requested maxcount.
Solution: return the remembered last_maxcount (glepnir)
closes: vim/vim#20701
4352dc6ab0
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -2740,7 +2740,7 @@ static void update_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, searchst
|
||||
stat->cnt = cnt;
|
||||
stat->exact_match = exact_match;
|
||||
stat->incomplete = incomplete;
|
||||
stat->last_maxcount = (int)p_msc;
|
||||
stat->last_maxcount = last_maxcount;
|
||||
return;
|
||||
}
|
||||
last_maxcount = maxcount;
|
||||
|
||||
@@ -2363,4 +2363,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
|
||||
|
||||
Reference in New Issue
Block a user