]> granicus.if.org Git - vim/commitdiff
patch 8.1.2245: third character of 'listchars' tab shows in wrong place v8.1.2245
authorBram Moolenaar <Bram@vim.org>
Sun, 3 Nov 2019 14:46:48 +0000 (15:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 3 Nov 2019 14:46:48 +0000 (15:46 +0100)
Problem:    Third character of 'listchars' tab shows in wrong place when
            'breakindent' is set.
Solution:   Set c_final to NUL. (Naruhiko Nishino, closes #5165)

src/drawline.c
src/testdir/test_breakindent.vim
src/version.c

index dcfe92cc6e6ee976d8c87ff6551de4b7691c062c..ea9e4a9978fae6d54bd6715c6dd088b69da31b04 100644 (file)
@@ -1173,6 +1173,7 @@ win_line(
 # endif
                    p_extra = NULL;
                    c_extra = ' ';
+                   c_final = NUL;
                    n_extra = get_breakindent_win(wp,
                                       ml_get_buf(wp->w_buffer, lnum, FALSE));
                    // Correct end of highlighted area for 'breakindent',
@@ -1647,9 +1648,8 @@ win_line(
 #ifdef FEAT_LINEBREAK
            int c0;
 #endif
+           VIM_CLEAR(p_extra_free);
 
-           if (p_extra_free != NULL)
-               VIM_CLEAR(p_extra_free);
            // Get a character from the line itself.
            c = *ptr;
 #ifdef FEAT_LINEBREAK
index 785709fc0ff42d299a27b637b413e311c8a55a6b..90c0ca5af0984d62c3e3887fd9bf9b1733edb501 100644 (file)
@@ -614,3 +614,44 @@ func Test_breakindent16_vartabs()
   call s:compare_lines(expect, lines)
   call s:close_windows('set vts&')
 endfunc
+
+func Test_breakindent17_vartabs()
+  if !has("vartabs")
+    return
+  endif
+  let s:input = ""
+  call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++')
+  call setline(1, "\t" . repeat('a', 63))
+  vert resize 30
+  norm! 1gg$
+  redraw!
+  let lines = s:screen_lines(1, 30)
+  let expect = [
+       \ "<-->aaaaaaaaaaaaaaaaaaaaaaaaaa",
+       \ "    +++aaaaaaaaaaaaaaaaaaaaaaa",
+       \ "    +++aaaaaaaaaaaaaa         ",
+       \ ]
+  call s:compare_lines(expect, lines)
+  call s:close_windows('set breakindent& list& listchars& showbreak&')
+endfunc
+
+func Test_breakindent18_vartabs()
+  if !has("vartabs")
+    return
+  endif
+  let s:input = ""
+  call s:test_windows('setl breakindent list listchars=tab:<->')
+  call setline(1, "\t" . repeat('a', 63))
+  vert resize 30
+  norm! 1gg$
+  redraw!
+  let lines = s:screen_lines(1, 30)
+  let expect = [
+       \ "<-->aaaaaaaaaaaaaaaaaaaaaaaaaa",
+       \ "    aaaaaaaaaaaaaaaaaaaaaaaaaa",
+       \ "    aaaaaaaaaaa               ",
+       \ ]
+  call s:compare_lines(expect, lines)
+  call s:close_windows('set breakindent& list& listchars&')
+endfunc
+
index 5f009e316f0d6e0b569dd45d56013e969cfb2b4d..d7c8c8b430fb73f216b91f2c1178e0974ecf1fd3 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2245,
 /**/
     2244,
 /**/