]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.1058: multiline conceal causes display errors v8.2.1058
authorBram Moolenaar <Bram@vim.org>
Thu, 25 Jun 2020 20:23:48 +0000 (22:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 25 Jun 2020 20:23:48 +0000 (22:23 +0200)
Problem:    Multiline conceal causes display errors.
Solution:   Do not allow conceal cross over EOL. (closes #6326, closes #4854,
            closes #6302)

src/drawline.c
src/testdir/test_conceal.vim
src/testdir/test_diffmode.vim
src/version.c

index fad0645fe86690ffe228d1d61ad56fc85743d618..fa2596510a8324d2245e022312d78c4bdce2ca29 100644 (file)
@@ -1334,6 +1334,11 @@ win_line(
                                      &screen_search_hl, &has_match_conc,
                                      &match_conc, did_line_attr, lcs_eol_one);
                ptr = line + v;  // "line" may have been changed
+
+               // Do not allow a conceal over EOL otherwise EOL will be missed
+               // and bad things happen.
+               if (*ptr == NUL)
+                   has_match_conc = 0;
            }
 #endif
 
index bf942b788022c11138aa07fc79a64737b00951b1..b555682d2dfb1918d585c66efbfc4d391b7cab98 100644 (file)
@@ -254,4 +254,26 @@ func Test_conceal_cursor_pos()
   call delete('XTest_conceal_curpos')
 endfunc
 
+func Test_conceal_eol()
+  new!
+  setlocal concealcursor=n conceallevel=1
+  call setline(1, ["x", ""])
+  call matchaddpos('Conceal', [[2, 1, 1]], 2, -1, {'conceal': 1})
+  redraw!
+
+  call assert_notequal(screenchar(1, 1), screenchar(2, 2))
+  call assert_equal(screenattr(1, 1), screenattr(1, 2))
+  call assert_equal(screenattr(1, 2), screenattr(2, 2))
+  call assert_equal(screenattr(2, 1), screenattr(2, 2))
+
+  set list
+  redraw!
+
+  call assert_equal(screenattr(1, 1), screenattr(2, 2))
+  call assert_notequal(screenattr(1, 1), screenattr(1, 2))
+  call assert_notequal(screenattr(1, 2), screenattr(2, 1))
+
+  set nolist
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 4544834b9dc241cb18146baeb253c7832d206d47..a3f6d5867b39d952fd28efd5d58688c7492bb65e 100644 (file)
@@ -1118,4 +1118,16 @@ func Test_diff_rnu()
   call delete('Xtest_diff_rnu')
 endfunc
 
+func Test_diff_multilineconceal()
+  new
+  diffthis
+
+  new
+  call matchadd('Conceal', 'a\nb', 9, -1, {'conceal': 'Y'})
+  set cole=2 cocu=n
+  call setline(1, ["a", "b"])
+  diffthis
+  redraw
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 144e57bd22acd3699b00de4b4fa64371796fe1c4..de8807a528b879cfa512e953e05c9179c72544a1 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1058,
 /**/
     1057,
 /**/