diff options
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r-- | src/nvim/indent.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 895d0d9f37..b7e3842aad 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -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); |