diff src/normal.c @ 28399:d395fadbaf67 v8.2.4724

patch 8.2.4724: current instance of last search pattern not easily spotted Commit: https://github.com/vim/vim/commit/a43993897aa372159f682df37562f159994dc85c Author: LemonBoy <thatlemon@gmail.com> Date: Sat Apr 9 21:04:08 2022 +0100 patch 8.2.4724: current instance of last search pattern not easily spotted Problem: Current instance of last search pattern not easily spotted. Solution: Add CurSearch highlighting. (closes https://github.com/vim/vim/issues/10133)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Apr 2022 22:15:03 +0200
parents d1702731786c
children d1982178f787
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -4153,6 +4153,7 @@ nv_search(cmdarg_T *cap)
 						      ? 0 : SEARCH_MARK, NULL);
 }
 
+
 /*
  * Handle "N" and "n" commands.
  * cap->arg is SEARCH_REV for "N", 0 for "n".
@@ -4173,6 +4174,12 @@ nv_next(cmdarg_T *cap)
 	(void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);
 	cap->count1 -= 1;
     }
+
+#ifdef FEAT_SEARCH_EXTRA
+    // Redraw the window to refresh the highlighted matches.
+    if (i > 0 && p_hls && !no_hlsearch)
+	redraw_later(SOME_VALID);
+#endif
 }
 
 /*
@@ -4190,6 +4197,7 @@ normal_search(
 {
     int		i;
     searchit_arg_T sia;
+    pos_T	prev_cursor = curwin->w_cursor;
 
     cap->oap->motion_type = MCHAR;
     cap->oap->inclusive = FALSE;
@@ -4213,6 +4221,11 @@ normal_search(
 	    foldOpenCursor();
 #endif
     }
+#ifdef FEAT_SEARCH_EXTRA
+    // Redraw the window to refresh the highlighted matches.
+    if (!EQUAL_POS(curwin->w_cursor, prev_cursor) && p_hls && !no_hlsearch)
+	redraw_later(SOME_VALID);
+#endif
 
     // "/$" will put the cursor after the end of the line, may need to
     // correct that here