Created
September 22, 2017 02:12
-
-
Save mattn/997375e55ad1b42fa590c50ae3e73e89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/normal.c b/src/normal.c | |
index 6fffbcbc1..ef8f5d4cf 100644 | |
--- a/src/normal.c | |
+++ b/src/normal.c | |
@@ -5451,14 +5451,6 @@ nv_clear(cmdarg_T *cap) | |
#ifdef FEAT_SYN_HL | |
/* Clear all syntax states to force resyncing. */ | |
syn_stack_free_all(curwin->w_s); | |
-# ifdef FEAT_RELTIME | |
- { | |
- win_T *wp; | |
- | |
- FOR_ALL_WINDOWS(wp) | |
- wp->w_s->b_syn_slow = FALSE; | |
- } | |
-# endif | |
#endif | |
redraw_later(CLEAR); | |
} | |
diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro | |
index f6ecb8c49..ef41acefb 100644 | |
--- a/src/proto/syntax.pro | |
+++ b/src/proto/syntax.pro | |
@@ -1,5 +1,5 @@ | |
/* syntax.c */ | |
-void syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm); | |
+void syntax_start(win_T *wp, linenr_T lnum); | |
void syn_stack_free_all(synblock_T *block); | |
void syn_stack_apply_changes(buf_T *buf); | |
void syntax_end_parsing(linenr_T lnum); | |
diff --git a/src/regexp.c b/src/regexp.c | |
index c4745ce7a..e13061fd3 100644 | |
--- a/src/regexp.c | |
+++ b/src/regexp.c | |
@@ -5756,6 +5756,8 @@ regmatch( | |
printf("Premature EOL\n"); | |
#endif | |
} | |
+ if (status == RA_FAIL) | |
+ got_int = TRUE; | |
return (status == RA_MATCH); | |
} | |
@@ -8222,6 +8224,8 @@ report_re_switch(char_u *pat) | |
} | |
#endif | |
+static int vim_regexec_both(regmatch_T *rmp, char_u *line, colnr_T col, int nl); | |
+ | |
/* | |
* Match a regexp against a string. | |
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). | |
@@ -8232,7 +8236,7 @@ report_re_switch(char_u *pat) | |
* Return TRUE if there is a match, FALSE if not. | |
*/ | |
static int | |
-vim_regexec_string( | |
+vim_regexec_both( | |
regmatch_T *rmp, | |
char_u *line, /* string to match against */ | |
colnr_T col, /* column to start looking for match */ | |
@@ -8295,12 +8299,12 @@ vim_regexec_prog( | |
char_u *line, | |
colnr_T col) | |
{ | |
- int r; | |
- regmatch_T regmatch; | |
+ int r; | |
+ regmatch_T regmatch; | |
regmatch.regprog = *prog; | |
regmatch.rm_ic = ignore_case; | |
- r = vim_regexec_string(®match, line, col, FALSE); | |
+ r = vim_regexec_both(®match, line, col, FALSE); | |
*prog = regmatch.regprog; | |
return r; | |
} | |
@@ -8312,7 +8316,7 @@ vim_regexec_prog( | |
int | |
vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col) | |
{ | |
- return vim_regexec_string(rmp, line, col, FALSE); | |
+ return vim_regexec_both(rmp, line, col, FALSE); | |
} | |
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ | |
@@ -8325,7 +8329,7 @@ vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col) | |
int | |
vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col) | |
{ | |
- return vim_regexec_string(rmp, line, col, TRUE); | |
+ return vim_regexec_both(rmp, line, col, TRUE); | |
} | |
#endif | |
diff --git a/src/screen.c b/src/screen.c | |
index 9f39edf04..e77d51800 100644 | |
--- a/src/screen.c | |
+++ b/src/screen.c | |
@@ -131,7 +131,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T | |
static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); | |
static void copy_text_attr(int off, char_u *buf, int len, int attr); | |
#endif | |
-static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm); | |
+static int win_line(win_T *, linenr_T, int, int, int nochange); | |
static int char_needs_redraw(int off_from, int off_to, int cols); | |
static void draw_vsep_win(win_T *wp, int row); | |
#ifdef FEAT_STL_OPT | |
@@ -916,9 +916,6 @@ update_single_line(win_T *wp, linenr_T lnum) | |
{ | |
int row; | |
int j; | |
-#ifdef SYN_TIME_LIMIT | |
- proftime_T syntax_tm; | |
-#endif | |
/* Don't do anything if the screen structures are (not yet) valid. */ | |
if (!screen_valid(TRUE) || updating_screen) | |
@@ -927,10 +924,6 @@ update_single_line(win_T *wp, linenr_T lnum) | |
if (lnum >= wp->w_topline && lnum < wp->w_botline | |
&& foldedCount(wp, lnum, &win_foldinfo) == 0) | |
{ | |
-#ifdef SYN_TIME_LIMIT | |
- /* Set the time limit to 'redrawtime'. */ | |
- profile_setlimit(p_rdt, &syntax_tm); | |
-#endif | |
update_prepare(); | |
row = 0; | |
@@ -944,13 +937,7 @@ update_single_line(win_T *wp, linenr_T lnum) | |
start_search_hl(); | |
prepare_search_hl(wp, lnum); | |
# endif | |
- win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE, | |
-#ifdef SYN_TIME_LIMIT | |
- &syntax_tm | |
-#else | |
- NULL | |
-#endif | |
- ); | |
+ win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE); | |
# if defined(FEAT_SEARCH_EXTRA) | |
end_search_hl(); | |
# endif | |
@@ -1142,9 +1129,6 @@ win_update(win_T *wp) | |
#if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA) | |
int save_got_int; | |
#endif | |
-#ifdef SYN_TIME_LIMIT | |
- proftime_T syntax_tm; | |
-#endif | |
type = wp->w_redr_type; | |
@@ -1802,10 +1786,6 @@ win_update(win_T *wp) | |
save_got_int = got_int; | |
got_int = 0; | |
#endif | |
-#ifdef SYN_TIME_LIMIT | |
- /* Set the time limit to 'redrawtime'. */ | |
- profile_setlimit(p_rdt, &syntax_tm); | |
-#endif | |
#ifdef FEAT_FOLDING | |
win_foldinfo.fi_level = 0; | |
#endif | |
@@ -2109,13 +2089,7 @@ win_update(win_T *wp) | |
/* | |
* Display one line. | |
*/ | |
- row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0, | |
-#ifdef SYN_TIME_LIMIT | |
- &syntax_tm | |
-#else | |
- NULL | |
-#endif | |
- ); | |
+ row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0); | |
#ifdef FEAT_FOLDING | |
wp->w_lines[idx].wl_folded = FALSE; | |
@@ -3000,8 +2974,8 @@ win_line( | |
linenr_T lnum, | |
int startrow, | |
int endrow, | |
- int nochange UNUSED, /* not updating for changed text */ | |
- proftime_T *syntax_tm UNUSED) | |
+ int nochange UNUSED /* not updating for changed text */ | |
+ ) | |
{ | |
int col = 0; /* visual column on screen */ | |
unsigned off; /* offset in ScreenLines/ScreenAttrs */ | |
@@ -3206,29 +3180,20 @@ win_line( | |
extra_check = 0; | |
#endif | |
#ifdef FEAT_SYN_HL | |
- if (syntax_present(wp) && !wp->w_s->b_syn_error | |
-# ifdef SYN_TIME_LIMIT | |
- && !wp->w_s->b_syn_slow | |
-# endif | |
- ) | |
+ if (syntax_present(wp) && !wp->w_s->b_syn_error) | |
{ | |
/* Prepare for syntax highlighting in this line. When there is an | |
* error, stop syntax highlighting. */ | |
save_did_emsg = did_emsg; | |
did_emsg = FALSE; | |
- syntax_start(wp, lnum, syntax_tm); | |
+ syntax_start(wp, lnum); | |
if (did_emsg) | |
wp->w_s->b_syn_error = TRUE; | |
else | |
{ | |
did_emsg = save_did_emsg; | |
-#ifdef SYN_TIME_LIMIT | |
- if (!wp->w_s->b_syn_slow) | |
-#endif | |
- { | |
- has_syntax = TRUE; | |
- extra_check = TRUE; | |
- } | |
+ has_syntax = TRUE; | |
+ extra_check = TRUE; | |
} | |
} | |
@@ -3614,7 +3579,7 @@ win_line( | |
# ifdef FEAT_SYN_HL | |
/* Need to restart syntax highlighting for this line. */ | |
if (has_syntax) | |
- syntax_start(wp, lnum, syntax_tm); | |
+ syntax_start(wp, lnum); | |
# endif | |
} | |
#endif | |
@@ -4569,10 +4534,6 @@ win_line( | |
} | |
else | |
did_emsg = save_did_emsg; | |
-#ifdef SYN_TIME_LIMIT | |
- if (wp->w_s->b_syn_slow) | |
- has_syntax = FALSE; | |
-#endif | |
/* Need to get the line again, a multi-line regexp may | |
* have made it invalid. */ | |
diff --git a/src/structs.h b/src/structs.h | |
index 94d739191..8d45aa2ff 100644 | |
--- a/src/structs.h | |
+++ b/src/structs.h | |
@@ -1855,9 +1855,6 @@ typedef struct { | |
hashtab_T b_keywtab; /* syntax keywords hash table */ | |
hashtab_T b_keywtab_ic; /* idem, ignore case */ | |
int b_syn_error; /* TRUE when error occurred in HL */ | |
-# ifdef FEAT_RELTIME | |
- int b_syn_slow; /* TRUE when 'redrawtime' reached */ | |
-# endif | |
int b_syn_ic; /* ignore case for :syn cmds */ | |
int b_syn_spell; /* SYNSPL_ values */ | |
garray_T b_syn_patterns; /* table for syntax patterns */ | |
diff --git a/src/syntax.c b/src/syntax.c | |
index 6361bd7aa..622bc9435 100644 | |
--- a/src/syntax.c | |
+++ b/src/syntax.c | |
@@ -367,9 +367,6 @@ static reg_extmatch_T *next_match_extmatch = NULL; | |
static win_T *syn_win; /* current window for highlighting */ | |
static buf_T *syn_buf; /* current buffer for highlighting */ | |
static synblock_T *syn_block; /* current buffer for highlighting */ | |
-#ifdef FEAT_RELTIME | |
-static proftime_T *syn_tm; | |
-#endif | |
static linenr_T current_lnum = 0; /* lnum of current state */ | |
static colnr_T current_col = 0; /* column of current state */ | |
static int current_state_stored = 0; /* TRUE if stored current state | |
@@ -497,7 +494,7 @@ static void syn_incl_toplevel(int id, int *flagsp); | |
* window. | |
*/ | |
void | |
-syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) | |
+syntax_start(win_T *wp, linenr_T lnum) | |
{ | |
synstate_T *p; | |
synstate_T *last_valid = NULL; | |
@@ -527,9 +524,6 @@ syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) | |
} | |
changedtick = CHANGEDTICK(syn_buf); | |
syn_win = wp; | |
-#ifdef FEAT_RELTIME | |
- syn_tm = syntax_tm; | |
-#endif | |
/* | |
* Allocate syntax stack when needed. | |
@@ -3306,9 +3300,6 @@ syn_regexec( | |
syn_time_T *st UNUSED) | |
{ | |
int r; | |
-#ifdef FEAT_RELTIME | |
- int timed_out = FALSE; | |
-#endif | |
#ifdef FEAT_PROFILE | |
proftime_T pt; | |
@@ -3317,13 +3308,7 @@ syn_regexec( | |
#endif | |
rmp->rmm_maxcol = syn_buf->b_p_smc; | |
- r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, | |
-#ifdef FEAT_RELTIME | |
- syn_tm, &timed_out | |
-#else | |
- NULL, NULL | |
-#endif | |
- ); | |
+ r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL, NULL); | |
#ifdef FEAT_PROFILE | |
if (syn_time_on) | |
@@ -3337,10 +3322,6 @@ syn_regexec( | |
++st->match; | |
} | |
#endif | |
-#ifdef FEAT_RELTIME | |
- if (timed_out) | |
- syn_win->w_s->b_syn_slow = TRUE; | |
-#endif | |
if (r > 0) | |
{ | |
@@ -3599,9 +3580,6 @@ syntax_clear(synblock_T *block) | |
int i; | |
block->b_syn_error = FALSE; /* clear previous error */ | |
-#ifdef FEAT_RELTIME | |
- block->b_syn_slow = FALSE; /* clear previous timeout */ | |
-#endif | |
block->b_syn_ic = FALSE; /* Use case, by default */ | |
block->b_syn_spell = SYNSPL_DEFAULT; /* default spell checking */ | |
block->b_syn_containedin = FALSE; | |
@@ -6569,7 +6547,7 @@ syn_get_id( | |
if (wp->w_buffer != syn_buf | |
|| lnum != current_lnum | |
|| col < current_col) | |
- syntax_start(wp, lnum, NULL); | |
+ syntax_start(wp, lnum); | |
else if (wp->w_buffer == syn_buf | |
&& lnum == current_lnum | |
&& col > current_col) | |
@@ -6638,14 +6616,9 @@ syn_get_foldlevel(win_T *wp, long lnum) | |
int i; | |
/* Return quickly when there are no fold items at all. */ | |
- if (wp->w_s->b_syn_folditems != 0 | |
- && !wp->w_s->b_syn_error | |
-# ifdef SYN_TIME_LIMIT | |
- && !wp->w_s->b_syn_slow | |
-# endif | |
- ) | |
+ if (wp->w_s->b_syn_folditems != 0) | |
{ | |
- syntax_start(wp, lnum, NULL); | |
+ syntax_start(wp, lnum); | |
for (i = 0; i < current_state.ga_len; ++i) | |
if (CUR_STATE(i).si_flags & HL_FOLD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment