diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-24 18:53:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-11-24 19:03:23 +0800 |
commit | e38ae3b74ff513d991f8212dfbba75fe8c66aad3 (patch) | |
tree | 25702f3efbf45f7f287fdee2162883b2b4391656 /src | |
parent | 81c87857f632d1afe147e9b77a97da38f8f3a887 (diff) | |
download | rneovim-e38ae3b74ff513d991f8212dfbba75fe8c66aad3.tar.gz rneovim-e38ae3b74ff513d991f8212dfbba75fe8c66aad3.tar.bz2 rneovim-e38ae3b74ff513d991f8212dfbba75fe8c66aad3.zip |
vim-patch:8.2.3940: match highlight disappears when doing incsearch for ":s/pat"
Problem: Match highlight disappears when doing incsearch for ":s/pat".
Solution: Only use line limit for incsearch highlighting. (closes vim/vim#9425)
https://github.com/vim/vim/commit/94fb8274ca8c93a10102d41c8bcc848f75cb7334
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/match.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_match.vim | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/match.c b/src/nvim/match.c index c38c4e7daf..83d1055fd0 100644 --- a/src/nvim/match.c +++ b/src/nvim/match.c @@ -425,7 +425,7 @@ static void next_search_hl(win_T *win, match_T *search_hl, match_T *shl, linenr_ const int called_emsg_before = called_emsg; // for :{range}s/pat only highlight inside the range - if (lnum < search_first_line || lnum > search_last_line) { + if ((lnum < search_first_line || lnum > search_last_line) && cur == NULL) { shl->lnum = 0; return; } diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim index e9dae8d67e..3c63314253 100644 --- a/src/nvim/testdir/test_match.vim +++ b/src/nvim/testdir/test_match.vim @@ -380,6 +380,27 @@ func Test_match_in_linebreak() call delete('XscriptMatchLinebreak') endfunc +func Test_match_with_incsearch() + CheckRunVimInTerminal + + let lines =<< trim END + set incsearch + call setline(1, range(20)) + call matchaddpos('ErrorMsg', [3]) + END + call writefile(lines, 'XmatchWithIncsearch') + let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6}) + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {}) + + call term_sendkeys(buf, ":s/0") + call VerifyScreenDump(buf, 'Test_match_with_incsearch_2', {}) + + call term_sendkeys(buf, "\<CR>") + call StopVimInTerminal(buf) + call delete('XmatchWithIncsearch') +endfunc + " Test for deleting matches outside of the screen redraw top/bottom lines " This should cause a redraw of those lines. func Test_matchdelete_redraw() |