diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-06-19 08:24:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-19 08:24:29 +0800 |
| commit | b381b2d529741ddd4f3664959640917a10cd91b5 (patch) | |
| tree | 4c606a997f28a74b531ab2888e2f59eac5329d70 /src/nvim/normal.c | |
| parent | a2d510e1015d57f28ab20c5d2897527cae15b9c4 (diff) | |
| parent | a2a3e8412e6d4e9a952c57a5298016cae8bf5229 (diff) | |
| download | rneovim-b381b2d529741ddd4f3664959640917a10cd91b5.tar.gz rneovim-b381b2d529741ddd4f3664959640917a10cd91b5.tar.bz2 rneovim-b381b2d529741ddd4f3664959640917a10cd91b5.zip | |
Merge pull request #29404 from zeertzjq/vim-8.2.4724
vim-patch:8.2.{4724,5047}: make CurSearch behavior match Vim
Diffstat (limited to 'src/nvim/normal.c')
| -rw-r--r-- | src/nvim/normal.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 3343803bb1..cbd068401a 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3973,6 +3973,12 @@ static void nv_next(cmdarg_T *cap) normal_search(cap, 0, NULL, 0, SEARCH_MARK | cap->arg, NULL); cap->count1 -= 1; } + + // Redraw the window to refresh the highlighted matches. + if (i > 0 && p_hls && !no_hlsearch + && win_hl_attr(curwin, HLF_LC) != win_hl_attr(curwin, HLF_L)) { + redraw_later(curwin, UPD_SOME_VALID); + } } /// Search for "pat" in direction "dir" ('/' or '?', 0 for repeat). @@ -3984,6 +3990,7 @@ static void nv_next(cmdarg_T *cap) static int normal_search(cmdarg_T *cap, int dir, char *pat, size_t patlen, int opt, int *wrapped) { searchit_arg_T sia; + pos_T const prev_cursor = curwin->w_cursor; cap->oap->motion_type = kMTCharWise; cap->oap->inclusive = false; @@ -4007,6 +4014,11 @@ static int normal_search(cmdarg_T *cap, int dir, char *pat, size_t patlen, int o foldOpenCursor(); } } + // Redraw the window to refresh the highlighted matches. + if (!equalpos(curwin->w_cursor, prev_cursor) && p_hls && !no_hlsearch + && win_hl_attr(curwin, HLF_LC) != win_hl_attr(curwin, HLF_L)) { + redraw_later(curwin, UPD_SOME_VALID); + } // "/$" will put the cursor after the end of the line, may need to // correct that here |