On Fr, 10 Feb 2017, Christian Brabandt wrote:
> Hi Axel!
>
> On Fr, 10 Feb 2017, Axel Bender wrote:
>
> > Using the attached file (Windows 7, 64-bit, GCC 6.3.0, 8.0-1.324), and
> > scrolling to the right with the horizontal scrollbar, tabs are no longer
> > aligned.
> >
> > I haven't done a bisect, but I think this is a relatively new problem
> > (8.0-x).
> >
>
> > iiiiiiiiiiiiiiii aaaaaaaaaaaaaaaaaa
> > iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii aaaaaaaaaaaaaaaaaa
> > iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii aaaaaaaaaaaaaaaaaa
> > iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
> > aaaaaaaaaaaaaaaaaa
>
> Thanks for that. I believe this is caused by 8.0.290 I'll have to check,
> whether there is a better solution for that. Sorry for that. As a
> workaround, you might want to backout 8.0.290 until this is properly
> fixed.
Here is a patch, that reverts that behaviour. The patch includes 2
tests.
1) a test for your issue.
2) a test for the issue, 8.0.0290 fixed.
One thing to mention, because I stumbled over it several times in the
past:
when running the screen test and e.g. using
:norm! $
:redraw!
this will NOT correctly redraw the cursorline, but draw from the
beginning of the line. I don't know if this is a bug or not it was
certainly unexpected. One needs to manually set skipcol using e.g.
winrestview({'skipcol': x) to make Vim redraw the screen correctly.
This has me bitten already several times with some screen tests and
I had to work around it explicitly. It just happened today again and I
found out how to fix this.
Perhaps there is way to fix this properly?
Best,
Christian
--
In der Moral zählt nur die Absicht, in der Kunst nur das Ergebnis.
-- Henry de Montherlant
--
--
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 18ae8b902..414c2bbf5 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3430,8 +3430,9 @@ win_line(
--ptr;
#endif
#ifdef FEAT_MBYTE
- /* character fits on the screen, don't need to skip it */
- if ((*mb_ptr2cells)(ptr) >= c && col == 0)
+ /* character fits on the screen, don't need to skip it,
+ * but don't do it for a TAB */
+ if (((*mb_ptr2cells)(ptr) >= c || *ptr == TAB) && col == 0)
#endif
n_skip = v - vcol;
}
diff --git a/src/testdir/test_listlbr.vim b/src/testdir/test_listlbr.vim
index 71366a161..7856ee82a 100644
--- a/src/testdir/test_listlbr.vim
+++ b/src/testdir/test_listlbr.vim
@@ -217,3 +217,19 @@ func Test_list_with_listchars()
call s:compare_lines(expect, lines)
call s:close_windows()
endfunc
+
+func Test_list_with_tab_and_skipping_first_chars()
+ call s:test_windows('setl list listchars=tab:>- ts=70 nowrap')
+ call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"])
+ call cursor(4,64)
+ norm! 2zl
+ let lines = s:screen_lines([1, 4], winwidth(0))
+ let expect = [
+\ "---------------aaaaa",
+\ "---------------aaaaa",
+\ "---------------aaaaa",
+\ "iiiiiiiii>-----aaaaa",
+\ ]
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+endfu
diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim
index 807b6ad31..32bd8cb3a 100644
--- a/src/testdir/test_listlbr_utf8.vim
+++ b/src/testdir/test_listlbr_utf8.vim
@@ -193,3 +193,41 @@ func Test_multibyte_sign_and_colorcolumn()
call s:compare_lines(expect, lines)
call s:close_windows()
endfunc
+
+func Test_chinese_char_on_wrap_column()
+ call s:test_windows("setl nolbr wrap sbr=")
+ syntax off
+ call setline(1, [
+\ 'aaaaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'aaaaaaaaaaaaaaaaa中'.
+\ 'hello'])
+ call cursor(1,1)
+ norm! $
+ " need to manually set skipcol,
+ " otherwise redraw! would not redraw
+ " correctly the cursor line
+ " but start from the beginning of the line
+ call winrestview({'skipcol':18})
+ let expect=[
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中aaaaaaaaaaaaaaaaa>',
+\ '中hello ']
+ let lines = s:screen_lines([1, 10], winwidth(0))
+ call s:compare_lines(expect, lines)
+ call s:close_windows()
+endfu