aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-12-06 17:21:12 -0700
committerMichael Ennen <mike.ennen@gmail.com>2016-12-06 22:57:30 -0700
commit0e99d291699dc5548f891340a4abb1541041b854 (patch)
tree5e2c15ee05f81d08f4b1a00afa497e440b7d61ba /src/nvim/screen.c
parentc5d2e442a34e090ed3e9294c4d1d51b3c23d8d24 (diff)
downloadrneovim-0e99d291699dc5548f891340a4abb1541041b854.tar.gz
rneovim-0e99d291699dc5548f891340a4abb1541041b854.tar.bz2
rneovim-0e99d291699dc5548f891340a4abb1541041b854.zip
vim-patch:8.0.0033
Problem: Cannot use overlapping positions with matchaddpos(). Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi) https://github.com/vim/vim/commit/a6c27ee6db2c328e0ab0e6d143e2a295a0bb9c9a
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 2b6005b484..ac8d14efb1 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5563,7 +5563,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
// in progress
n = 0;
while (shl->first_lnum < lnum && (shl->rm.regprog != NULL
- || (cur != NULL && pos_inprogress))) {
+ || (cur != NULL && pos_inprogress))) {
next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n,
shl == &search_hl ? NULL : cur);
pos_inprogress = !(cur == NULL || cur->pos.cur == 0);
@@ -5711,20 +5711,22 @@ 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 (bot != -1) {
// 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];
+ if (pos->col < posmatch->pos[bot].col) {
+ llpos_T tmp = *pos;
- posmatch->pos[i] = posmatch->pos[bot];
+ *pos = posmatch->pos[bot];
posmatch->pos[bot] = tmp;
}
} else {