mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 12:38:33 +00:00
vim-patch:7.4.519
Problem: Crash when using syntax highlighting. Solution: When regprog is freed and replaced, store the result. https://github.com/vim/vim/tree/v7-4-519 Helped-by: Scott Prager <splinterofchaos@gmail.com>
This commit is contained in:

committed by
Justin M. Keyes

parent
4230f8c332
commit
b3519ca73b
@@ -827,8 +827,10 @@ static int syn_match_linecont(linenr_T lnum)
|
||||
if (syn_block->b_syn_linecont_prog != NULL) {
|
||||
regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
|
||||
regmatch.regprog = syn_block->b_syn_linecont_prog;
|
||||
return syn_regexec(®match, lnum, (colnr_T)0,
|
||||
IF_SYN_TIME(&syn_block->b_syn_linecont_time));
|
||||
int r = syn_regexec(®match, lnum, (colnr_T)0,
|
||||
IF_SYN_TIME(&syn_block->b_syn_linecont_time));
|
||||
syn_block->b_syn_linecont_prog = regmatch.regprog;
|
||||
return r;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1798,10 +1800,10 @@ syn_current_attr (
|
||||
|
||||
regmatch.rmm_ic = spp->sp_ic;
|
||||
regmatch.regprog = spp->sp_prog;
|
||||
if (!syn_regexec(®match,
|
||||
current_lnum,
|
||||
(colnr_T)lc_col,
|
||||
IF_SYN_TIME(&spp->sp_time))) {
|
||||
int r = syn_regexec(®match, current_lnum, (colnr_T)lc_col,
|
||||
IF_SYN_TIME(&spp->sp_time));
|
||||
spp->sp_prog = regmatch.regprog;
|
||||
if (!r) {
|
||||
/* no match in this line, try another one */
|
||||
spp->sp_startcol = MAXCOL;
|
||||
continue;
|
||||
@@ -2585,8 +2587,10 @@ find_endpos (
|
||||
|
||||
regmatch.rmm_ic = spp->sp_ic;
|
||||
regmatch.regprog = spp->sp_prog;
|
||||
if (syn_regexec(®match, startpos->lnum, lc_col,
|
||||
IF_SYN_TIME(&spp->sp_time))) {
|
||||
int r = syn_regexec(®match, startpos->lnum, lc_col,
|
||||
IF_SYN_TIME(&spp->sp_time));
|
||||
spp->sp_prog = regmatch.regprog;
|
||||
if (r) {
|
||||
if (best_idx == -1 || regmatch.startpos[0].col
|
||||
< best_regmatch.startpos[0].col) {
|
||||
best_idx = idx;
|
||||
@@ -2614,10 +2618,10 @@ find_endpos (
|
||||
lc_col = 0;
|
||||
regmatch.rmm_ic = spp_skip->sp_ic;
|
||||
regmatch.regprog = spp_skip->sp_prog;
|
||||
if (syn_regexec(®match, startpos->lnum, lc_col,
|
||||
IF_SYN_TIME(&spp_skip->sp_time))
|
||||
&& regmatch.startpos[0].col
|
||||
<= best_regmatch.startpos[0].col) {
|
||||
int r = syn_regexec(®match, startpos->lnum, lc_col,
|
||||
IF_SYN_TIME(&spp_skip->sp_time));
|
||||
spp_skip->sp_prog = regmatch.regprog;
|
||||
if (r && regmatch.startpos[0].col <= best_regmatch.startpos[0].col) {
|
||||
/* Add offset to skip pattern match */
|
||||
syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1);
|
||||
|
||||
|
Reference in New Issue
Block a user