diff options
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 b74bae6e6..a1012d268 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) { |