0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3198: cannot use 'formatlistpat' for breakindent

Problem:    Cannot use 'formatlistpat' for breakindent.
Solution:   Use a negative list indent. (Maxim Kim, closes #8594)
This commit is contained in:
Maxim Kim
2021-07-22 11:46:59 +02:00
committed by Bram Moolenaar
parent d8e44476d8
commit f674b358fc
4 changed files with 71 additions and 8 deletions

View File

@@ -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(&regmatch, 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;