Skip to content

Commit a87b72c

Browse files
committed
patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Problem: Display problem with 'vartabstop' and 'linebreak'. (Chauca Fuentes) Solution: Call tabstop_padding(). (Christian Brabandt, closes #3076)
1 parent b7a5ab1 commit a87b72c

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/screen.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4753,8 +4753,13 @@ win_line(
47534753
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
47544754
NULL) - 1;
47554755
if (c == TAB && n_extra + col > wp->w_width)
4756+
#ifdef FEAT_VARTABS
4757+
n_extra = tabstop_padding(vcol, wp->w_buffer->b_p_ts,
4758+
wp->w_buffer->b_p_vts_array) - 1;
4759+
#else
47564760
n_extra = (int)wp->w_buffer->b_p_ts
47574761
- vcol % (int)wp->w_buffer->b_p_ts - 1;
4762+
#endif
47584763

47594764
# ifdef FEAT_MBYTE
47604765
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';

src/testdir/test_vartabs.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ if !has("vartabs")
44
finish
55
endif
66

7+
source view_util.vim
8+
function! s:compare_lines(expect, actual)
9+
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
10+
endfunction
11+
712
func! Test_vartabs()
813
new
914
%d
@@ -255,3 +260,23 @@ func! Test_vartabs_breakindent()
255260

256261
bwipeout!
257262
endfunc
263+
264+
func! Test_vartabs_linebreak()
265+
if winwidth(0) < 80
266+
return
267+
endif
268+
new
269+
70vnew
270+
%d
271+
setl linebreak vartabstop=10,15,20,40
272+
call setline(1, "\tx\tx\tx\tx")
273+
274+
let lines = ScreenLines([1, 2], winwidth(0))
275+
let expect = [' x x x ',
276+
\ ' x ']
277+
call s:compare_lines(expect, lines)
278+
279+
" cleanup
280+
bw!
281+
bw!
282+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ static char *(features[]) =
789789

790790
static int included_patches[] =
791791
{ /* Add new patch number below this line */
792+
/**/
793+
116,
792794
/**/
793795
115,
794796
/**/

0 commit comments

Comments
 (0)