diff src/screen.c @ 10273:489eae19cad9 v8.0.0033

commit https://github.com/vim/vim/commit/a6c27ee6db2c328e0ab0e6d143e2a295a0bb9c9a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 15 14:56:30 2016 +0200 patch 8.0.0033 Problem: Cannot use overlapping positions with matchaddpos(). Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sat, 15 Oct 2016 15:00:04 +0200
parents d54d4a258b96
children 1c1fcf515607
line wrap: on
line diff
--- a/src/screen.c
+++ b/src/screen.c
@@ -7786,21 +7786,23 @@ next_search_hl_pos(
     shl->lnum = 0;
     for (i = posmatch->cur; i < MAXPOSMATCH; i++)
     {
-	if (posmatch->pos[i].lnum == 0)
+	llpos_T	*pos = &posmatch->pos[i];
+
+	if (pos->lnum == 0)
 	    break;
-	if (posmatch->pos[i].col < mincol)
+	if (pos->col + pos->len - 1 <= mincol)
 	    continue;
-	if (posmatch->pos[i].lnum == lnum)
+	if (pos->lnum == lnum)
 	{
 	    if (shl->lnum == lnum)
 	    {
 		/* partially sort positions by column numbers
 		 * on the same line */
-		if (posmatch->pos[i].col < posmatch->pos[bot].col)
-		{
-		    llpos_T	tmp = posmatch->pos[i];
-
-		    posmatch->pos[i] = posmatch->pos[bot];
+		if (pos->col < posmatch->pos[bot].col)
+		{
+		    llpos_T	tmp = *pos;
+
+		    *pos = posmatch->pos[bot];
 		    posmatch->pos[bot] = tmp;
 		}
 	    }