On Sa, 23 Jun 2018, Israel Chauca Fuentes wrote:
> Set up: Run vim with this command in a 90 columns wide terminal window:
>
> vim -Nu NONE -i NONE -c 'set linebreak vartabstop=10,20,30,40,50,60,70'
> -c 'call setline(1, "\tx\tx\tx\tx")'
>
> Expected: After this, the fourth 'x' should be on the second line with the
> cursor.
>
> Result: The fourth 'x' is displayed in the first line, very close to the
> third 'x'.
>
> This is the output of `vim --version`:
Thanks for the clear explanation. The attached patch fixes it (only
visible in the mailinglist). I took the liberty to turn your example
into a test.
Best,
Christian
--
Die Kunst zu leben ist nicht zu existieren, sondern den
anderen zu zeigen, dass man existiert!
-- Benjamin Stramke
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/screen.c b/src/screen.c
index b5b68e4df..ce715d8c4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4753,8 +4753,13 @@ win_line(
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
NULL) - 1;
if (c == TAB && n_extra + col > wp->w_width)
+ #ifdef FEAT_VARTABS
+ n_extra = tabstop_padding(vcol, wp->w_buffer->b_p_ts,
+ wp->w_buffer->b_p_vts_array) - 1;
+#else
n_extra = (int)wp->w_buffer->b_p_ts
- vcol % (int)wp->w_buffer->b_p_ts - 1;
+ #endif
# ifdef FEAT_MBYTE
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
diff --git a/src/testdir/test_vartabs.vim b/src/testdir/test_vartabs.vim
index 85914f6bc..a1257cda5 100644
--- a/src/testdir/test_vartabs.vim
+++ b/src/testdir/test_vartabs.vim
@@ -4,6 +4,11 @@ if !has("vartabs")
finish
endif
+source view_util.vim
+function! s:compare_lines(expect, actual)
+ call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
+endfunction
+
func! Test_vartabs()
new
%d
@@ -255,3 +260,23 @@ func! Test_vartabs_breakindent()
bwipeout!
endfunc
+
+func! Test_vartabs_linebreak()
+ if winwidth(0) < 90
+ return
+ endif
+ new
+ 90vnew
+ %d
+ setl linebreak vartabstop=10,20,30,40,50,60,70
+ call setline(1, "\tx\tx\tx\tx")
+
+ let lines = ScreenLines([1, 2], winwidth(0))
+ let expect = [' x x x ',
+ \ ' x ']
+ call s:compare_lines(expect, lines)
+
+ " cleanup
+ bw!
+ bw!
+endfunc