aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-08-08 18:07:57 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-08-08 22:22:34 -0400
commit43a874ab7441a4a0ab6e973f4fd7add394ed6dd9 (patch)
treeecba9c783bf59e7c7e3658ad7175da297af9f32f /src/nvim/indent.c
parentf89a275e32110a63e8ee1fc6ca75e0cf09194185 (diff)
downloadrneovim-43a874ab7441a4a0ab6e973f4fd7add394ed6dd9.tar.gz
rneovim-43a874ab7441a4a0ab6e973f4fd7add394ed6dd9.tar.bz2
rneovim-43a874ab7441a4a0ab6e973f4fd7add394ed6dd9.zip
vim-patch:8.2.3198: cannot use 'formatlistpat' for breakindent
Problem: Cannot use 'formatlistpat' for breakindent. Solution: Use a negative list indent. (Maxim Kim, closes vim/vim#8594) https://github.com/vim/vim/commit/f674b358fc18cf1641a066cc5de73da69e651024 Port get_showbreak_value() from patch v8.1.2281 to avoid breaking changes when porting older patches.
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) {