diff src/screen.c @ 9992:3e3b0ce24b61 v7.4.2269

commit https://github.com/vim/vim/commit/e17bdffff78ebd6a4e3cff26754cc667557ea810 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 27 18:34:29 2016 +0200 patch 7.4.2269 Problem: Using 'hlsearch' highlighting instead of matchpos if there is no search match. Solution: Pass NULL as last item to next_search_hl() when searching for 'hlsearch' match. (Shane Harper, closes #1013)
author Christian Brabandt <cb@256bit.org>
date Sat, 27 Aug 2016 18:45:06 +0200
parents ccb6461b82df
children 4aead6a9b7a9
line wrap: on
line diff
--- a/src/screen.c
+++ b/src/screen.c
@@ -3546,7 +3546,8 @@ win_line(
 	v = (long)(ptr - line);
 	if (cur != NULL)
 	    cur->pos.cur = 0;
-	next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
+	next_search_hl(wp, shl, lnum, (colnr_T)v,
+					       shl == &search_hl ? NULL : cur);
 
 	/* Need to get the line again, a multi-line regexp may have made it
 	 * invalid. */
@@ -3980,7 +3981,8 @@ win_line(
 #ifdef FEAT_CONCEAL
 			    prev_syntax_id = 0;
 #endif
-			    next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
+			    next_search_hl(wp, shl, lnum, (colnr_T)v,
+					       shl == &search_hl ? NULL : cur);
 			    pos_inprogress = cur == NULL || cur->pos.cur == 0
 							       ? FALSE : TRUE;
 
@@ -7607,7 +7609,8 @@ prepare_search_hl(win_T *wp, linenr_T ln
 	    while (shl->first_lnum < lnum && (shl->rm.regprog != NULL
 					  || (cur != NULL && pos_inprogress)))
 	    {
-		next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, cur);
+		next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n,
+					       shl == &search_hl ? NULL : cur);
 		pos_inprogress = cur == NULL || cur->pos.cur == 0
 							      ? FALSE : TRUE;
 		if (shl->lnum != 0)