Mercurial > vim
comparison src/testdir/test_search_stat.vim @ 20697:1260b27535b5 v8.2.0902
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Commit: https://github.com/vim/vim/commit/442a85369f3eb9834dbab42add45f7c4106700f4
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 4 20:56:09 2020 +0200
patch 8.2.0902: using searchcount() in 'statusline' causes an error
Problem: Using searchcount() in 'statusline' causes an error.
Solution: Avoid saving/restoring the search patten recursively.
(closes #6194)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Jun 2020 21:00:03 +0200 |
parents | 4c66962d322b |
children | ce36225c9bed |
comparison
equal
deleted
inserted
replaced
20696:5e91479ba748 | 20697:1260b27535b5 |
---|---|
259 bwipe! | 259 bwipe! |
260 endfunc | 260 endfunc |
261 | 261 |
262 func Test_searchcount_fails() | 262 func Test_searchcount_fails() |
263 call assert_fails('echo searchcount("boo!")', 'E715:') | 263 call assert_fails('echo searchcount("boo!")', 'E715:') |
264 endfunc | |
265 | |
266 func Test_searchcount_in_statusline() | |
267 CheckScreendump | |
268 | |
269 let lines =<< trim END | |
270 set shortmess-=S | |
271 call append(0, 'this is something') | |
272 function TestSearchCount() abort | |
273 let search_count = searchcount() | |
274 if !empty(search_count) | |
275 return '[' . search_count.current . '/' . search_count.total . ']' | |
276 else | |
277 return '' | |
278 endif | |
279 endfunction | |
280 set hlsearch | |
281 set laststatus=2 statusline+=%{TestSearchCount()} | |
282 END | |
283 call writefile(lines, 'Xsearchstatusline') | |
284 let buf = RunVimInTerminal('-S Xsearchstatusline', #{rows: 10}) | |
285 call TermWait(buf) | |
286 call term_sendkeys(buf, "/something") | |
287 call VerifyScreenDump(buf, 'Test_searchstat_4', {}) | |
288 | |
289 call term_sendkeys(buf, "\<Esc>") | |
290 call StopVimInTerminal(buf) | |
291 call delete('Xsearchstatusline') | |
264 endfunc | 292 endfunc |
265 | 293 |
266 func Test_search_stat_foldopen() | 294 func Test_search_stat_foldopen() |
267 CheckScreendump | 295 CheckScreendump |
268 | 296 |