summaryrefslogtreecommitdiff
path: root/src/highlight.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-23 22:59:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-23 22:59:18 +0100
commit53989554a44caca0964376d60297f08ec257c53c (patch)
tree34d2140d4201e015661344b05ffb4c2d9aed97ff /src/highlight.c
parent70188f5b23ea7efec7adaf74e0af797d1bb1afe8 (diff)
downloadvim-git-53989554a44caca0964376d60297f08ec257c53c.tar.gz
patch 8.2.0035: saving and restoring called_emsg is clumsyv8.2.0035
Problem: Saving and restoring called_emsg is clumsy. Solution: Count the number of error messages.
Diffstat (limited to 'src/highlight.c')
-rw-r--r--src/highlight.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/highlight.c b/src/highlight.c
index da2bdc651..564cf3a23 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -4055,7 +4055,7 @@ next_search_hl(
linenr_T l;
colnr_T matchcol;
long nmatched;
- int save_called_emsg = called_emsg;
+ int called_emsg_before = called_emsg;
// for :{range}s/pat only highlight inside the range
if (lnum < search_first_line || lnum > search_last_line)
@@ -4081,7 +4081,6 @@ next_search_hl(
* Repeat searching for a match until one is found that includes "mincol"
* or none is found in this line.
*/
- called_emsg = FALSE;
for (;;)
{
# ifdef FEAT_RELTIME
@@ -4143,7 +4142,7 @@ next_search_hl(
if (regprog_is_copy)
cur->match.regprog = cur->hl.rm.regprog;
- if (called_emsg || got_int || timed_out)
+ if (called_emsg > called_emsg_before || got_int || timed_out)
{
// Error while handling regexp: stop using this regexp.
if (shl == search_hl)
@@ -4176,9 +4175,6 @@ next_search_hl(
break; // useful match found
}
}
-
- // Restore called_emsg for assert_fails().
- called_emsg = save_called_emsg;
}
/*