diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-23 19:23:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-23 19:23:02 +0200 |
commit | 04958cbaf25eea27eceedaa987adfb354ad5f7fd (patch) | |
tree | 9a47e4e99b5b702e12d08c0424a91ae701eabb4d /src/charset.c | |
parent | 5ec7414a1c0512832f60c17437d6374cbf4b08e9 (diff) | |
download | vim-git-04958cbaf25eea27eceedaa987adfb354ad5f7fd.tar.gz |
patch 8.1.0105: all tab stops are the samev8.1.0105
Problem: All tab stops are the same.
Solution: Add the variable tabstop feature. (Christian Brabandt,
closes #2711)
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c index 179fc89db..a4816887e 100644 --- a/src/charset.c +++ b/src/charset.c @@ -812,7 +812,16 @@ vim_strnsize(char_u *s, int len) * Also see getvcol() below. */ -#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \ +#ifdef FEAT_VARTABS +# define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \ + if (*(p) == TAB && (!(wp)->w_p_list || lcs_tab1)) \ + { \ + return tabstop_padding(col, (buf)->b_p_ts, (buf)->b_p_vts_array); \ + } \ + else \ + return ptr2cells(p); +#else +# define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \ if (*(p) == TAB && (!(wp)->w_p_list || lcs_tab1)) \ { \ int ts; \ @@ -821,6 +830,7 @@ vim_strnsize(char_u *s, int len) } \ else \ return ptr2cells(p); +#endif int chartabsize(char_u *p, colnr_T col) @@ -1221,8 +1231,13 @@ win_nolbr_chartabsize( if (*s == TAB && (!wp->w_p_list || lcs_tab1)) { +# ifdef FEAT_VARTABS + return tabstop_padding(col, wp->w_buffer->b_p_ts, + wp->w_buffer->b_p_vts_array); +# else n = wp->w_buffer->b_p_ts; return (int)(n - (col % n)); +# endif } n = ptr2cells(s); /* Add one cell for a double-width character in the last column of the @@ -1282,6 +1297,9 @@ getvcol( char_u *line; /* start of the line */ int incr; int head; +#ifdef FEAT_VARTABS + int *vts = wp->w_buffer->b_p_vts_array; +#endif int ts = wp->w_buffer->b_p_ts; int c; @@ -1332,7 +1350,11 @@ getvcol( } /* A tab gets expanded, depending on the current column */ if (c == TAB) +#ifdef FEAT_VARTABS + incr = tabstop_padding(vcol, ts, vts); +#else incr = ts - (vcol % ts); +#endif else { #ifdef FEAT_MBYTE |