]> granicus.if.org Git - vim/commitdiff
patch 8.0.0394: tabs are not aligned when scrolling horizontally v8.0.0394
authorBram Moolenaar <Bram@vim.org>
Wed, 1 Mar 2017 17:04:05 +0000 (18:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 1 Mar 2017 17:04:05 +0000 (18:04 +0100)
Problem:    Tabs are not aligned when scrolling horizontally and a Tab doesn't
            fit. (Axel Bender)
Solution:   Handle a Tab as a not fitting character. (Christian Brabandt)
            Also fix that ":redraw" does not scroll horizontally to show the
            cursor.  And fix the test that depended on the old behavior.

src/ex_docmd.c
src/screen.c
src/testdir/test_breakindent.vim
src/testdir/test_listlbr.vim
src/testdir/test_listlbr_utf8.vim
src/version.c

index 4c52cdf808961562a507812fb9ddbf189f0b6fcd..0bf940f3198d57f17bceeee0eb7d5bc115cb4a2d 100644 (file)
@@ -9812,6 +9812,7 @@ ex_redraw(exarg_T *eap)
 
     RedrawingDisabled = 0;
     p_lz = FALSE;
+    validate_cursor();
     update_topline();
     update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0);
 #ifdef FEAT_TITLE
index 8514f3e3846466ba7c11e4d3f9dc9e676f1dfdbb..20a778a68ac00f166c1ad96f30c237e1ac3863f9 100644 (file)
@@ -3429,10 +3429,13 @@ win_line(
 #else
            --ptr;
 #endif
+           /* If the character fits on the screen, don't need to skip it.
+            * Except for a TAB. */
+           if ((
 #ifdef FEAT_MBYTE
-           /* character fits on the screen, don't need to skip it */
-           if ((*mb_ptr2cells)(ptr) >= c && col == 0)
+                       (*mb_ptr2cells)(ptr) >= c ||
 #endif
+                      *ptr == TAB) && col == 0)
               n_skip = v - vcol;
        }
 
index 8721b35cdf67c324ed7ece279a5b0a3dbf874048..7deffbe452397913fc0f95a2f9e56bf0cb3ea479 100644 (file)
@@ -274,7 +274,6 @@ endfunction
 
 function Test_breakindent16()
   " Check that overlong lines are indented correctly.
-  " TODO: currently it does not fail even when the bug is not fixed.
   let s:input=""
   call s:test_windows('setl breakindent briopt=min:0 ts=4')
   call setline(1, "\t".repeat("1234567890", 10))
@@ -283,16 +282,16 @@ function Test_breakindent16()
   redraw!
   let lines=s:screen_lines(1,10)
   let expect=[
-\ "    123456",
 \ "    789012",
 \ "    345678",
+\ "    901234",
 \ ]
   call s:compare_lines(expect, lines)
   let lines=s:screen_lines(4,10)
   let expect=[
-\ "    901234",
 \ "    567890",
 \ "    123456",
+\ "    7890  ",
 \ ]
   call s:compare_lines(expect, lines)
   call s:close_windows()
index 71366a161e2cae12527eeffefeb16896ad44884b..7856ee82ab30e56821a8927c52f6a14fe2272e06 100644 (file)
@@ -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
index 99db37ee6c0279cffa5871556ab5c2c68e1ab89b..56a4cc9b311cbb0b43683839f01eac64d9105949 100644 (file)
@@ -220,3 +220,37 @@ func Test_multibyte_wrap_and_breakat()
   call s:compare_lines(expect, lines)
   call s:close_windows('setl brk&vim')
 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! $
+  redraw!
+  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
index 49e33012e68717e6a4258adb10ab6f6524238cca..ee828fdc82d5bb08590aef24eb4c3be02dc9e0f6 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    394,
 /**/
     393,
 /**/