forked from aniani/vim
patch 7.4.2217
Problem: When using matchaddpos() a character after the end of the line can be highlighted. Solution: Only highlight existing characters. (Hirohito Higashi)
This commit is contained in:
@@ -3542,6 +3542,7 @@ win_line(
|
||||
shl->startcol = MAXCOL;
|
||||
shl->endcol = MAXCOL;
|
||||
shl->attr_cur = 0;
|
||||
shl->is_addpos = FALSE;
|
||||
v = (long)(ptr - line);
|
||||
if (cur != NULL)
|
||||
cur->pos.cur = 0;
|
||||
@@ -5125,14 +5126,14 @@ win_line(
|
||||
* needed when a '$' was displayed for 'list'. */
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
prevcol_hl_flag = FALSE;
|
||||
if (prevcol == (long)search_hl.startcol)
|
||||
if (!search_hl.is_addpos && prevcol == (long)search_hl.startcol)
|
||||
prevcol_hl_flag = TRUE;
|
||||
else
|
||||
{
|
||||
cur = wp->w_match_head;
|
||||
while (cur != NULL)
|
||||
{
|
||||
if (prevcol == (long)cur->hl.startcol)
|
||||
if (!cur->hl.is_addpos && prevcol == (long)cur->hl.startcol)
|
||||
{
|
||||
prevcol_hl_flag = TRUE;
|
||||
break;
|
||||
@@ -5207,7 +5208,8 @@ win_line(
|
||||
}
|
||||
else
|
||||
shl = &cur->hl;
|
||||
if ((ptr - line) - 1 == (long)shl->startcol)
|
||||
if ((ptr - line) - 1 == (long)shl->startcol
|
||||
&& (shl == &search_hl || !shl->is_addpos))
|
||||
char_attr = shl->attr;
|
||||
if (shl != &search_hl && cur != NULL)
|
||||
cur = cur->next;
|
||||
@@ -7815,6 +7817,7 @@ next_search_hl_pos(
|
||||
shl->rm.startpos[0].col = start;
|
||||
shl->rm.endpos[0].lnum = 0;
|
||||
shl->rm.endpos[0].col = end;
|
||||
shl->is_addpos = TRUE;
|
||||
posmatch->cur = bot + 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user