diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-31 13:43:12 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-31 13:43:12 +0100 |
commit | 368137aa525982984beed73940af481ac53a62af (patch) | |
tree | 6b6c9fc6b00fb7ed3fb71bb3b53d01f62f8e981a /src/drawscreen.c | |
parent | 4aaf3e7f4db599932d01d87e5bbcdc342cccee27 (diff) | |
download | vim-git-368137aa525982984beed73940af481ac53a62af.tar.gz |
patch 8.2.5047: CurSearch highlight is often wrongv8.2.5047
Problem: CurSearch highlight is often wrong.
Solution: Remember the last highlighted position and redraw when needed.
Diffstat (limited to 'src/drawscreen.c')
-rw-r--r-- | src/drawscreen.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c index 2838bf88c..ed8927127 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -1618,6 +1618,19 @@ win_update(win_T *wp) } #endif } + +#ifdef FEAT_SEARCH_EXTRA + if (search_hl_has_cursor_lnum > 0) + { + // CurSearch was used last time, need to redraw the line with it to + // avoid having two matches highlighted with CurSearch. + if (mod_top == 0 || mod_top > search_hl_has_cursor_lnum) + mod_top = search_hl_has_cursor_lnum; + if (mod_bot == 0 || mod_bot < search_hl_has_cursor_lnum + 1) + mod_bot = search_hl_has_cursor_lnum + 1; + } +#endif + #ifdef FEAT_FOLDING if (mod_top != 0 && hasAnyFolding(wp)) { @@ -1684,6 +1697,10 @@ win_update(win_T *wp) } wp->w_redraw_top = 0; // reset for next time wp->w_redraw_bot = 0; +#ifdef FEAT_SEARCH_EXTRA + search_hl_has_cursor_lnum = 0; +#endif + // When only displaying the lines at the top, set top_end. Used when // window has scrolled down for msg_scrolled. |