diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-04-27 01:41:43 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-04-27 01:41:43 -0400 |
commit | 0928904e16a8cc68492732c773931fcedf7efdac (patch) | |
tree | 147d5e2dec0c82477647dc499b164b38e43a5ada /src/nvim/syntax.c | |
parent | 4230f8c332ce56ed2369f1500f7eaceb0bd968f3 (diff) | |
parent | d9a51ca8119ba05056d593b8ca5b7161d12fc1c1 (diff) | |
download | rneovim-0928904e16a8cc68492732c773931fcedf7efdac.tar.gz rneovim-0928904e16a8cc68492732c773931fcedf7efdac.tar.bz2 rneovim-0928904e16a8cc68492732c773931fcedf7efdac.zip |
Merge #2349 'vim-patch:7.4.519'
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 2df0e72f8f..ec54887246 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -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); |