aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 0148979335..855c09619e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2962,8 +2962,13 @@ win_line (
if (shl->startcol != MAXCOL
&& v >= (long)shl->startcol
&& v < (long)shl->endcol) {
+ int tmp_col = v + MB_PTR2LEN(ptr);
+
+ if (shl->endcol < tmp_col) {
+ shl->endcol = tmp_col;
+ }
shl->attr_cur = shl->attr;
- } else if (v >= (long)shl->endcol && shl->lnum == lnum) {
+ } else if (v == (long)shl->endcol) {
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
@@ -5733,7 +5738,18 @@ next_search_hl (
shl->lnum = lnum;
if (shl->rm.regprog != NULL) {
+ /* Remember whether shl->rm is using a copy of the regprog in
+ * cur->match. */
+ bool regprog_is_copy = (shl != &search_hl
+ && cur != NULL
+ && shl == &cur->hl
+ && cur->match.regprog == cur->hl.rm.regprog);
+
nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, &(shl->tm));
+ /* Copy the regprog, in case it got freed and recompiled. */
+ if (regprog_is_copy) {
+ cur->match.regprog = cur->hl.rm.regprog;
+ }
if (called_emsg || got_int) {
// Error while handling regexp: stop using this regexp.
if (shl == &search_hl) {