summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-25 22:23:48 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-25 22:23:48 +0200
commitfc838d6cb0f22c77a6ee2befd034b593e1c5ea06 (patch)
tree460d06257776232261d5e716511c2544786ba38e /src
parent1e4c7d0ed272201fa3a7cf34a462abb139170759 (diff)
downloadvim-git-fc838d6cb0f22c77a6ee2befd034b593e1c5ea06.tar.gz
patch 8.2.1058: multiline conceal causes display errorsv8.2.1058
Problem: Multiline conceal causes display errors. Solution: Do not allow conceal cross over EOL. (closes #6326, closes #4854, closes #6302)
Diffstat (limited to 'src')
-rw-r--r--src/drawline.c5
-rw-r--r--src/testdir/test_conceal.vim22
-rw-r--r--src/testdir/test_diffmode.vim12
-rw-r--r--src/version.c2
4 files changed, 41 insertions, 0 deletions
diff --git a/src/drawline.c b/src/drawline.c
index fad0645fe..fa2596510 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -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
diff --git a/src/testdir/test_conceal.vim b/src/testdir/test_conceal.vim
index bf942b788..b555682d2 100644
--- a/src/testdir/test_conceal.vim
+++ b/src/testdir/test_conceal.vim
@@ -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
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 4544834b9..a3f6d5867 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 144e57bd2..de8807a52 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1058,
+/**/
1057,
/**/
1056,