diff options
author | Christian Brabandt <cb@256bit.org> | 2022-05-06 12:21:04 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-06 12:21:04 +0100 |
commit | e7d6dbc5721342e3d6b04cf285e4510b5569e707 (patch) | |
tree | 4cb238d111079f6caefb9f15a7612ea3d556aedd /src/indent.c | |
parent | 509142ab7a9db32114b6d0949722b9133c9c22f2 (diff) | |
download | vim-git-e7d6dbc5721342e3d6b04cf285e4510b5569e707.tar.gz |
patch 8.2.4882: cannot make 'breakindent' use a specific columnv8.2.4882
Problem: Cannot make 'breakindent' use a specific column.
Solution: Add the "column" entry in 'breakindentopt'. (Christian Brabandt,
closes #10362, closes #10325)
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/indent.c b/src/indent.c index 9efa52753..e8892b517 100644 --- a/src/indent.c +++ b/src/indent.c @@ -866,6 +866,7 @@ briopt_check(win_T *wp) long bri_min = 20; int bri_sbr = FALSE; int bri_list = 0; + int bri_vcol = 0; p = wp->w_p_briopt; while (*p != NUL) @@ -891,6 +892,11 @@ briopt_check(win_T *wp) p += 5; bri_list = getdigits(&p); } + else if (STRNCMP(p, "column:", 7) == 0) + { + p += 7; + bri_vcol = getdigits(&p); + } if (*p != ',' && *p != NUL) return FAIL; if (*p == ',') @@ -901,6 +907,7 @@ briopt_check(win_T *wp) wp->w_briopt_min = bri_min; wp->w_briopt_sbr = bri_sbr; wp->w_briopt_list = bri_list; + wp->w_briopt_vcol = bri_vcol; return OK; } @@ -953,11 +960,13 @@ get_breakindent_win( prev_tick = CHANGEDTICK(wp->w_buffer); # ifdef FEAT_VARTABS prev_vts = wp->w_buffer->b_p_vts_array; - prev_indent = get_indent_str_vtab(line, + if (wp->w_briopt_vcol == 0) + prev_indent = get_indent_str_vtab(line, (int)wp->w_buffer->b_p_ts, wp->w_buffer->b_p_vts_array, wp->w_p_list); # else - prev_indent = get_indent_str(line, + if (wp->w_briopt_vcol == 0) + prev_indent = get_indent_str(line, (int)wp->w_buffer->b_p_ts, wp->w_p_list); # endif prev_listopt = wp->w_briopt_list; @@ -965,7 +974,7 @@ get_breakindent_win( vim_free(prev_flp); prev_flp = vim_strsave(get_flp_value(wp->w_buffer)); // add additional indent for numbered lists - if (wp->w_briopt_list != 0) + if (wp->w_briopt_list != 0 && wp->w_briopt_vcol == 0) { regmatch_T regmatch; @@ -986,7 +995,14 @@ get_breakindent_win( } } } - bri = prev_indent + wp->w_briopt_shift; + if (wp->w_briopt_vcol != 0) + { + // column value has priority + bri = wp->w_briopt_vcol; + prev_list = 0; + } + else + bri = prev_indent + wp->w_briopt_shift; // Add offset for number column, if 'n' is in 'cpoptions' bri += win_col_off2(wp); |