Patch 8.2.4918
Problem: Conceal character from matchadd() displayed too many times.
Solution: Check the syntax flag. (closes #10381, closes #7268)
Files: src/drawline.c, src/testdir/test_matchadd_conceal.vim
*** ../vim-8.2.4917/src/drawline.c 2022-05-07 20:01:10.050731702 +0100
--- src/drawline.c 2022-05-08 21:24:34.497873431 +0100
***************
*** 2477,2490 ****
#ifdef FEAT_CONCEAL
if ( wp->w_p_cole > 0
! && (wp != curwin || lnum != wp->w_cursor.lnum ||
! conceal_cursor_line(wp))
&& ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0)
&& !(lnum_in_visual_area
&& vim_strchr(wp->w_p_cocu, 'v') == NULL))
{
char_attr = conceal_attr;
! if ((prev_syntax_id != syntax_seqnr || has_match_conc > 1)
&& (syn_get_sub_char() != NUL
|| (has_match_conc && match_conc)
|| wp->w_p_cole == 1)
--- 2477,2492 ----
#ifdef FEAT_CONCEAL
if ( wp->w_p_cole > 0
! && (wp != curwin || lnum != wp->w_cursor.lnum
! || conceal_cursor_line(wp))
&& ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0)
&& !(lnum_in_visual_area
&& vim_strchr(wp->w_p_cocu, 'v') == NULL))
{
char_attr = conceal_attr;
! if (((prev_syntax_id != syntax_seqnr
! && (syntax_flags & HL_CONCEAL) != 0)
! || has_match_conc > 1)
&& (syn_get_sub_char() != NUL
|| (has_match_conc && match_conc)
|| wp->w_p_cole == 1)
*** ../vim-8.2.4917/src/testdir/test_matchadd_conceal.vim 2020-08-12 17:50:31.883655785 +0100
--- src/testdir/test_matchadd_conceal.vim 2022-05-08 21:19:40.629751994 +0100
***************
*** 339,344 ****
--- 339,365 ----
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
endfunc
+ func Test_interaction_matchadd_syntax()
+ CheckRunVimInTerminal
+
+ new
+ " Test for issue #7268 fix.
+ " When redrawing the second column, win_line() was comparing the sequence
+ " number of the syntax-concealed region with a bogus zero value that was
+ " returned for the matchadd-concealed region. Before 8.0.0672 the sequence
+ " number was never reset, thus masking the problem.
+ call setline(1, 'aaa|bbb|ccc')
+ call matchadd('Conceal', '^..', 10, -1, #{conceal: 'X'})
+ syn match foobar '^.'
+ setl concealcursor=n conceallevel=1
+ redraw!
+
+ call assert_equal('Xa|bbb|ccc', Screenline(1))
+ call assert_notequal(screenattr(1, 1), screenattr(1, 2))
+
+ bwipe!
+ endfunc
+
func Test_cursor_column_in_concealed_line_after_window_scroll()
CheckRunVimInTerminal
*** ../vim-8.2.4917/src/version.c 2022-05-08 21:10:52.653899496 +0100
--- src/version.c 2022-05-08 21:21:10.953805401 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4918,
/**/
--
hundred-and-one symptoms of being an internet addict:
140. You'd rather catch a score on the web than watch the game as
it is being played on tv.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///