diff options
author | Maxim Kim <habamax@gmail.com> | 2021-07-22 11:46:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-22 11:46:59 +0200 |
commit | f674b358fc18cf1641a066cc5de73da69e651024 (patch) | |
tree | 3c33d1d2bf53f95fc23102579857b47fa3b2e886 /src/indent.c | |
parent | d8e44476d84b5f0cc8c4de080a47a3a9af547028 (diff) | |
download | vim-git-f674b358fc18cf1641a066cc5de73da69e651024.tar.gz |
patch 8.2.3198: cannot use 'formatlistpat' for breakindentv8.2.3198
Problem: Cannot use 'formatlistpat' for breakindent.
Solution: Use a negative list indent. (Maxim Kim, closes #8594)
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/indent.c b/src/indent.c index cf07f4af6..ed7ce97f1 100644 --- a/src/indent.c +++ b/src/indent.c @@ -941,15 +941,11 @@ get_breakindent_win( } bri = prev_indent + wp->w_briopt_shift; - // indent minus the length of the showbreak string - if (wp->w_briopt_sbr) - bri -= vim_strsize(get_showbreak_value(wp)); - // Add offset for number column, if 'n' is in 'cpoptions' bri += win_col_off2(wp); // add additional indent for numbered lists - if (wp->w_briopt_list > 0) + if (wp->w_briopt_list != 0) { regmatch_T regmatch; @@ -958,11 +954,21 @@ get_breakindent_win( if (regmatch.regprog != NULL) { if (vim_regexec(®match, line, 0)) - bri += wp->w_briopt_list; + { + if (wp->w_briopt_list > 0) + bri += wp->w_briopt_list; + else + bri = (*regmatch.endp - *regmatch.startp); + } vim_regfree(regmatch.regprog); } } + // indent minus the length of the showbreak string + if (wp->w_briopt_sbr) + bri -= vim_strsize(get_showbreak_value(wp)); + + // never indent past left window margin if (bri < 0) bri = 0; |