aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r--src/nvim/indent.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 4e734421a4..bfb77688b0 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -462,15 +462,11 @@ int get_breakindent_win(win_T *wp, char_u *line)
}
bri = prev_indent + wp->w_briopt_shift;
- // indent minus the length of the showbreak string
- if (wp->w_briopt_sbr) {
- bri -= vim_strsize(p_sbr);
- }
// 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 = {
.regprog = vim_regcomp(curbuf->b_p_flp,
RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT),
@@ -478,12 +474,20 @@ int get_breakindent_win(win_T *wp, char_u *line)
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 = (int)(*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) {