diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index a6b628619b..f107291ab5 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -8455,11 +8455,12 @@ searchcount([{options}]) *searchcount()* To get the last search count when |n| or |N| was pressed, call this function with `recompute: 0` . This sometimes returns - wrong information because |n| and |N|'s maximum count is 999. - If it exceeded 999 the result must be max count + 1 (1000). If - you want to get correct information, specify `recompute: 1`: >vim + wrong information because of 'maxsearchcount'. + If the count exceeded 'maxsearchcount', the result must be + 'maxsearchcount' + 1. If you want to get correct information, + specify `recompute: 1`: >vim - " result == maxcount + 1 (1000) when many matches + " result == 'maxsearchcount' + 1 when many matches let result = searchcount(#{recompute: 0}) " Below returns correct result (recompute defaults @@ -8546,7 +8547,7 @@ searchcount([{options}]) *searchcount()* result. if search exceeded total count, "total" value becomes `maxcount + 1` - (default: 0) + (default: 'maxsearchcount') pos |List| `[lnum, col, off]` value when recomputing the result. this changes "current" result diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 2fd2aa82fe..e5f0bdf014 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -7698,11 +7698,12 @@ function vim.fn.search(pattern, flags, stopline, timeout, skip) end --- --- To get the last search count when |n| or |N| was pressed, call --- this function with `recompute: 0` . This sometimes returns ---- wrong information because |n| and |N|'s maximum count is 999. ---- If it exceeded 999 the result must be max count + 1 (1000). If ---- you want to get correct information, specify `recompute: 1`: >vim +--- wrong information because of 'maxsearchcount'. +--- If the count exceeded 'maxsearchcount', the result must be +--- 'maxsearchcount' + 1. If you want to get correct information, +--- specify `recompute: 1`: >vim --- ---- " result == maxcount + 1 (1000) when many matches +--- " result == 'maxsearchcount' + 1 when many matches --- let result = searchcount(#{recompute: 0}) --- --- " Below returns correct result (recompute defaults @@ -7789,7 +7790,7 @@ function vim.fn.search(pattern, flags, stopline, timeout, skip) end --- result. if search exceeded --- total count, "total" value --- becomes `maxcount + 1` ---- (default: 0) +--- (default: 'maxsearchcount') --- pos |List| `[lnum, col, off]` value --- when recomputing the result. --- this changes "current" result diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 8b5518e22f..7a4e202de8 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -261,7 +261,7 @@ call AddOption("ignorecase", gettext("ignore case when using a search patte call BinOptionG("ic", &ic) call AddOption("smartcase", gettext("override 'ignorecase' when pattern has upper case characters")) call BinOptionG("scs", &scs) -call AddOption("maxsearchcount", gettext("Maximum number for the search count feature")) +call AddOption("maxsearchcount", gettext("maximum number for the search count feature")) call OptionG("msc", &msc) call AddOption("casemap", gettext("what method to use for changing case of letters")) call OptionG("cmp", &cmp) diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 10dcc98cf9..8e6b82e311 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -9368,11 +9368,12 @@ M.funcs = { To get the last search count when |n| or |N| was pressed, call this function with `recompute: 0` . This sometimes returns - wrong information because |n| and |N|'s maximum count is 999. - If it exceeded 999 the result must be max count + 1 (1000). If - you want to get correct information, specify `recompute: 1`: >vim + wrong information because of 'maxsearchcount'. + If the count exceeded 'maxsearchcount', the result must be + 'maxsearchcount' + 1. If you want to get correct information, + specify `recompute: 1`: >vim - " result == maxcount + 1 (1000) when many matches + " result == 'maxsearchcount' + 1 when many matches let result = searchcount(#{recompute: 0}) " Below returns correct result (recompute defaults @@ -9459,7 +9460,7 @@ M.funcs = { result. if search exceeded total count, "total" value becomes `maxcount + 1` - (default: 0) + (default: 'maxsearchcount') pos |List| `[lnum, col, off]` value when recomputing the result. this changes "current" result diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index f1bc18a75b..67fcea348d 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -187,22 +187,22 @@ let test_values = { \ 's', 's/tmp/dir\\\ with\\\ space/*', \ 'w,b,k/tmp/dir\\\ with\\\ space/*,s'], \ ['xxx']], - \ 'concealcursor': [['', 'n', 'v', 'i', 'c', 'nvic'], ['xxx']], - "\ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup', - "\ " 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'preinsert', 'menu,longest'], - "\ " ['xxx', 'menu,,,longest,']], \ 'completefuzzycollect': [['', 'keyword', 'files', 'whole_line', \ 'keyword,whole_line', 'files,whole_line', 'keyword,files,whole_line'], \ ['xxx', 'keyword,,,whole_line,']], \ 'completeitemalign': [['abbr,kind,menu', 'menu,abbr,kind'], \ ['', 'xxx', 'abbr', 'abbr,menu', 'abbr,menu,kind,abbr', \ 'abbr1234,kind,menu']], + "\ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup', + "\ " 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'preinsert', 'menu,longest'], + "\ " ['xxx', 'menu,,,longest,']], "\ 'completepopup': [['', 'height:13', 'width:20', 'highlight:That', "\ " 'align:item', 'align:menu', 'border:on', 'border:off', "\ " 'width:10,height:234,highlight:Mine'], "\ " ['xxx', 'xxx:99', 'height:yes', 'width:no', 'align:xxx', "\ " 'border:maybe', 'border:1', 'border:']], \ 'completeslash': [['', 'slash', 'backslash'], ['xxx']], + \ 'concealcursor': [['', 'n', 'v', 'i', 'c', 'nvic'], ['xxx']], "\ 'cryptmethod': [['', 'zip'], ['xxx']], "\ 'cscopequickfix': [['', 's-', 'g-', 'd-', 'c-', 't-', 'e-', 'f-', 'i-', "\ " 'a-', 's-,c+,e0'], @@ -239,19 +239,19 @@ let test_values = { \ 'stl:\ ,vert:\|,fold:\\,trunc:…,diff:x'], \ ['xxx', 'vert:', 'trunc:', "trunc:\b"]], \ 'foldclose': [['', 'all'], ['xxx']], + \ 'foldmarker': [['((,))'], ['', 'xxx', '{{{,']], \ 'foldmethod': [['manual', 'indent', 'expr', 'marker', 'syntax', 'diff'], \ ['', 'xxx', 'expr,diff']], \ 'foldopen': [['', 'all', 'block', 'hor', 'insert', 'jump', 'mark', \ 'percent', 'quickfix', 'search', 'tag', 'undo', 'hor,jump'], \ ['xxx']], - \ 'foldmarker': [['((,))'], ['', 'xxx', '{{{,']], \ 'formatoptions': [['', 't', 'c', 'r', 'o', '/', 'q', 'w', 'a', 'n', '2', \ 'v', 'b', 'l', 'm', 'M', 'B', '1', ']', 'j', 'p', 'vt', 'v,t'], \ ['xxx']], \ 'guicursor': [['', 'n:block-Cursor'], ['xxx']], \ 'guifont': [['', fontname], []], - \ 'guifontwide': [['', fontname], []], "\ 'guifontset': [['', fontname], []], + \ 'guifontwide': [['', fontname], []], \ 'guioptions': [['', '!', 'a', 'P', 'A', 'c', 'd', 'e', 'f', 'i', 'm', \ 'M', 'g', 't', 'T', 'r', 'R', 'l', 'L', 'b', 'h', 'v', 'p', 'F', \ 'k', '!abvR'], @@ -259,9 +259,9 @@ let test_values = { \ 'helplang': [['', 'de', 'de,it'], ['xxx']], "\ 'highlight': [['', 'e:Error'], ['xxx']], "\ 'imactivatekey': [['', 'S-space'], ['xxx']], + \ 'isexpand': [['', '.,->', '/,/*,\\,'], [',,', '\\,,']], \ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']], \ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']], - \ 'isexpand': [['', '.,->', '/,/*,\\,'], [',,', '\\,,']], \ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']], \ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']], \ 'jumpoptions': [['', 'stack'], ['xxx']], @@ -277,6 +277,7 @@ let test_values = { \ 'eol:\\u21b5', 'eol:\\U000021b5', 'eol:x,space:y'], \ ['xxx', 'eol:']], \ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']], + \ 'maxsearchcount': [[1, 10, 100, 1000], [0, -1, 10000]], \ 'messagesopt': [['hit-enter,history:1', 'hit-enter,history:10000', \ 'history:100,wait:100', 'history:0,wait:0', \ 'hit-enter,history:1,wait:1'], @@ -304,11 +305,10 @@ let test_values = { "\ " ['xxx', 'xxx,c:yes', 'xxx:', 'xxx:,c:yes']], "\ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], "\ " ['xxx', 'header:-1']], - \ 'scrollopt': [['', 'ver', 'hor', 'jump', 'ver,hor'], ['xxx']], "\ 'renderoptions': [[''], ['xxx']], \ 'rightleftcmd': [['search'], ['xxx']], \ 'rulerformat': [['', 'xxx'], ['%-', '%(', '%15(%%']], - \ 'maxsearchcount': [[1, 10, 100, 1000], [0, -1, 10000]], + \ 'scrollopt': [['', 'ver', 'hor', 'jump', 'ver,hor'], ['xxx']], \ 'selection': [['old', 'inclusive', 'exclusive'], ['', 'xxx']], \ 'selectmode': [['', 'mouse', 'key', 'cmd', 'key,cmd'], ['xxx']], \ 'sessionoptions': [['', 'blank', 'curdir', 'sesdir', diff --git a/test/old/testdir/test_search_stat.vim b/test/old/testdir/test_search_stat.vim index 2e6d4f63f3..5281f785c7 100644 --- a/test/old/testdir/test_search_stat.vim +++ b/test/old/testdir/test_search_stat.vim @@ -537,10 +537,10 @@ func Test_search_stat_option() \ searchcount(#{recompute: 0})) call assert_equal( \ #{exact_match: 1, current: 27992, incomplete: 0, maxcount:0, total: 28000}, - \ searchcount(#{recompute: v:true, maxcount: 0, timeout: 200})) + \ searchcount(#{recompute: v:true, maxcount: 0, timeout: 500})) call assert_equal( \ #{exact_match: 1, current: 1, incomplete: 0, maxcount: 0, total: 28000}, - \ searchcount(#{recompute: 1, maxcount: 0, pos: [1, 1, 0], timeout: 200})) + \ searchcount(#{recompute: 1, maxcount: 0, pos: [1, 1, 0], timeout: 500})) call cursor(line('$'), 1) let g:a = execute(':unsilent :norm! n') let stat = 'W \[1/>999\]' @@ -550,10 +550,10 @@ func Test_search_stat_option() \ searchcount(#{recompute: 0})) call assert_equal( \ #{current: 1, exact_match: 1, total: 28000, incomplete: 0, maxcount: 0}, - \ searchcount(#{recompute: 1, maxcount: 0, timeout: 200})) + \ searchcount(#{recompute: 1, maxcount: 0, timeout: 500})) call assert_equal( \ #{current: 27991, exact_match: 1, total: 28000, incomplete: 0, maxcount: 0}, - \ searchcount(#{recompute: 1, maxcount: 0, pos: [line('$')-2, 1, 0], timeout: 200})) + \ searchcount(#{recompute: 1, maxcount: 0, pos: [line('$')-2, 1, 0], timeout: 500})) " Many matches call cursor(1, 1)