summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-10-15 14:56:30 +0200
committerBram Moolenaar <Bram@vim.org>2016-10-15 14:56:30 +0200
commita6c27ee6db2c328e0ab0e6d143e2a295a0bb9c9a (patch)
tree30807bca218d51b02f8e05a80277f191c5190a9c /src/screen.c
parent4575876dc865d4160f20d61bd822fbe7cafbec41 (diff)
downloadvim-git-a6c27ee6db2c328e0ab0e6d143e2a295a0bb9c9a.tar.gz
patch 8.0.0033v8.0.0033
Problem: Cannot use overlapping positions with matchaddpos(). Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi)
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/screen.c b/src/screen.c
index 5ebca0980..0889db91d 100644
--- 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)
+ if (pos->col < posmatch->pos[bot].col)
{
- llpos_T tmp = posmatch->pos[i];
+ llpos_T tmp = *pos;
- posmatch->pos[i] = posmatch->pos[bot];
+ *pos = posmatch->pos[bot];
posmatch->pos[bot] = tmp;
}
}