diff options
author | Christian Brabandt <cb@256bit.org> | 2022-01-15 10:01:05 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-15 10:01:05 +0000 |
commit | c53b467473160b5cfce77277fbae414bf43e66ce (patch) | |
tree | 0b9c46f21daf65cd1dde027cbae993bcb7d0608f /src/indent.c | |
parent | ece07639f4989a300276d66b13553c21a7435030 (diff) |
patch 8.2.4093: cached breakindent values not initialized properlyv8.2.4093
Problem: Cached breakindent values not initialized properly.
Solution: Initialize and cache formatlistpat. (Christian Brabandt,
closes #9526, closes #9512)
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/indent.c b/src/indent.c index b74bae6e69..a1012d2689 100644 --- a/src/indent.c +++ b/src/indent.c @@ -924,6 +924,8 @@ get_breakindent_win( # endif static int prev_list = 0; // cached list value static int prev_listopt = 0; // cached w_p_briopt_list value + // cached formatlistpat value + static char_u *prev_flp = NULL; int bri = 0; // window width minus window margin space, i.e. what rests for text const int eff_wwidth = wp->w_width @@ -931,10 +933,16 @@ get_breakindent_win( && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0); - // used cached indent, unless line, 'tabstop' or briopt_list changed + // used cached indent, unless + // - line pointer changed + // - 'tabstop' changed + // - 'briopt_list changed' changed or + // - 'formatlistpattern' changed if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts || prev_tick != CHANGEDTICK(wp->w_buffer) || prev_listopt != wp->w_briopt_list + || (prev_flp == NULL + || (STRCMP(prev_flp, get_flp_value(wp->w_buffer)) != 0)) # ifdef FEAT_VARTABS || prev_vts != wp->w_buffer->b_p_vts_array # endif @@ -953,13 +961,16 @@ get_breakindent_win( (int)wp->w_buffer->b_p_ts, wp->w_p_list); # endif prev_listopt = wp->w_briopt_list; + prev_list = 0; + vim_free(prev_flp); + prev_flp = vim_strsave(get_flp_value(wp->w_buffer)); // add additional indent for numbered lists if (wp->w_briopt_list != 0) { regmatch_T regmatch; - regmatch.regprog = vim_regcomp(curbuf->b_p_flp, - RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT); + regmatch.regprog = vim_regcomp(prev_flp, + RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT); if (regmatch.regprog != NULL) { |