Mercurial > vim
comparison src/regexp.c @ 11529:998d2cf59caa v8.0.0647
patch 8.0.0647: syntax highlighting can make cause a freeze
commit https://github.com/vim/vim/commit/06f1ed2f78c5c03af95054fc3a8665df39dec362
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 18 22:41:03 2017 +0200
patch 8.0.0647: syntax highlighting can make cause a freeze
Problem: Syntax highlighting can make cause a freeze.
Solution: Apply 'redrawtime' to syntax highlighting, per window.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 18 Jun 2017 22:45:04 +0200 |
parents | ac20f71e8aa4 |
children | e769c912fcd9 |
comparison
equal
deleted
inserted
replaced
11528:5d3f98e7f715 | 11529:998d2cf59caa |
---|---|
5754 EMSG(_(e_re_corr)); | 5754 EMSG(_(e_re_corr)); |
5755 #ifdef DEBUG | 5755 #ifdef DEBUG |
5756 printf("Premature EOL\n"); | 5756 printf("Premature EOL\n"); |
5757 #endif | 5757 #endif |
5758 } | 5758 } |
5759 if (status == RA_FAIL) | |
5760 got_int = TRUE; | |
5761 return (status == RA_MATCH); | 5759 return (status == RA_MATCH); |
5762 } | 5760 } |
5763 | 5761 |
5764 } /* End of loop until the regstack is empty. */ | 5762 } /* End of loop until the regstack is empty. */ |
5765 | 5763 |
8222 verbose_leave(); | 8220 verbose_leave(); |
8223 } | 8221 } |
8224 } | 8222 } |
8225 #endif | 8223 #endif |
8226 | 8224 |
8227 static int vim_regexec_both(regmatch_T *rmp, char_u *line, colnr_T col, int nl); | |
8228 | |
8229 /* | 8225 /* |
8230 * Match a regexp against a string. | 8226 * Match a regexp against a string. |
8231 * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). | 8227 * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). |
8232 * Note: "rmp->regprog" may be freed and changed. | 8228 * Note: "rmp->regprog" may be freed and changed. |
8233 * Uses curbuf for line count and 'iskeyword'. | 8229 * Uses curbuf for line count and 'iskeyword'. |
8234 * When "nl" is TRUE consider a "\n" in "line" to be a line break. | 8230 * When "nl" is TRUE consider a "\n" in "line" to be a line break. |
8235 * | 8231 * |
8236 * Return TRUE if there is a match, FALSE if not. | 8232 * Return TRUE if there is a match, FALSE if not. |
8237 */ | 8233 */ |
8238 static int | 8234 static int |
8239 vim_regexec_both( | 8235 vim_regexec_string( |
8240 regmatch_T *rmp, | 8236 regmatch_T *rmp, |
8241 char_u *line, /* string to match against */ | 8237 char_u *line, /* string to match against */ |
8242 colnr_T col, /* column to start looking for match */ | 8238 colnr_T col, /* column to start looking for match */ |
8243 int nl) | 8239 int nl) |
8244 { | 8240 { |
8297 regprog_T **prog, | 8293 regprog_T **prog, |
8298 int ignore_case, | 8294 int ignore_case, |
8299 char_u *line, | 8295 char_u *line, |
8300 colnr_T col) | 8296 colnr_T col) |
8301 { | 8297 { |
8302 int r; | 8298 int r; |
8303 regmatch_T regmatch; | 8299 regmatch_T regmatch; |
8304 | 8300 |
8305 regmatch.regprog = *prog; | 8301 regmatch.regprog = *prog; |
8306 regmatch.rm_ic = ignore_case; | 8302 regmatch.rm_ic = ignore_case; |
8307 r = vim_regexec_both(®match, line, col, FALSE); | 8303 r = vim_regexec_string(®match, line, col, FALSE); |
8308 *prog = regmatch.regprog; | 8304 *prog = regmatch.regprog; |
8309 return r; | 8305 return r; |
8310 } | 8306 } |
8311 | 8307 |
8312 /* | 8308 /* |
8314 * Return TRUE if there is a match, FALSE if not. | 8310 * Return TRUE if there is a match, FALSE if not. |
8315 */ | 8311 */ |
8316 int | 8312 int |
8317 vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col) | 8313 vim_regexec(regmatch_T *rmp, char_u *line, colnr_T col) |
8318 { | 8314 { |
8319 return vim_regexec_both(rmp, line, col, FALSE); | 8315 return vim_regexec_string(rmp, line, col, FALSE); |
8320 } | 8316 } |
8321 | 8317 |
8322 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ | 8318 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ |
8323 || defined(FIND_REPLACE_DIALOG) || defined(PROTO) | 8319 || defined(FIND_REPLACE_DIALOG) || defined(PROTO) |
8324 /* | 8320 /* |
8327 * Return TRUE if there is a match, FALSE if not. | 8323 * Return TRUE if there is a match, FALSE if not. |
8328 */ | 8324 */ |
8329 int | 8325 int |
8330 vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col) | 8326 vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col) |
8331 { | 8327 { |
8332 return vim_regexec_both(rmp, line, col, TRUE); | 8328 return vim_regexec_string(rmp, line, col, TRUE); |
8333 } | 8329 } |
8334 #endif | 8330 #endif |
8335 | 8331 |
8336 /* | 8332 /* |
8337 * Match a regexp against multiple lines. | 8333 * Match a regexp against multiple lines. |