mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
vim-patch:9.1.0720: Wrong breakindentopt=list:-1 with multibyte or TABs (#30293)
Problem: Wrong breakindentopt=list:-1 with multibyte chars or TABs in
text matched by 'formatlistpat' (John M Devin)
Solution: Use the width of the match text (zeertzjq)
fixes: vim/vim#15634
closes: vim/vim#15635
61a6ac4d00
This commit is contained in:
@@ -891,7 +891,17 @@ int get_breakindent_win(win_T *wp, char *line)
|
||||
if (wp->w_briopt_list > 0) {
|
||||
prev_list += wp->w_briopt_list;
|
||||
} else {
|
||||
prev_indent = (int)(*regmatch.endp - *regmatch.startp);
|
||||
char *ptr = *regmatch.startp;
|
||||
char *end_ptr = *regmatch.endp;
|
||||
int indent = 0;
|
||||
// Compute the width of the matched text.
|
||||
// Use win_chartabsize() so that TAB size is correct,
|
||||
// while wrapping is ignored.
|
||||
while (ptr < end_ptr) {
|
||||
indent += win_chartabsize(wp, ptr, indent);
|
||||
MB_PTR_ADV(ptr);
|
||||
}
|
||||
prev_indent = indent;
|
||||
}
|
||||
}
|
||||
vim_regfree(regmatch.regprog);
|
||||
|
Reference in New Issue
Block a user