aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-09 18:39:32 +0800
committerGitHub <noreply@github.com>2022-05-09 18:39:32 +0800
commit41ce7b07e2946bdde0061d7af5b4446efafa5089 (patch)
tree87f7bc200839d6a1dec1184911c3541b2fc0f57f /src
parent5382ed80288fa7476e0c249916c8def3c19726f9 (diff)
parent79929cf44d7e4c4717c68de336740e4e444f0f41 (diff)
downloadrneovim-41ce7b07e2946bdde0061d7af5b4446efafa5089.tar.gz
rneovim-41ce7b07e2946bdde0061d7af5b4446efafa5089.tar.bz2
rneovim-41ce7b07e2946bdde0061d7af5b4446efafa5089.zip
Merge pull request #18490 from zeertzjq/vim-8.2.4918
vim-patch:8.2.{4918,4923}: conceal character from matchadd() displayed too many times
Diffstat (limited to 'src')
-rw-r--r--src/nvim/screen.c9
-rw-r--r--src/nvim/testdir/test_matchadd_conceal.vim19
2 files changed, 23 insertions, 5 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 08ffc3abb2..4d0fde642d 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3666,13 +3666,12 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
}
if (wp->w_p_cole > 0
- && (wp != curwin || lnum != wp->w_cursor.lnum
- || conceal_cursor_line(wp))
+ && (wp != curwin || lnum != wp->w_cursor.lnum || conceal_cursor_line(wp))
&& ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0 || decor_conceal > 0)
- && !(lnum_in_visual_area
- && vim_strchr(wp->w_p_cocu, 'v') == NULL)) {
+ && !(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 || decor_conceal > 1)
+ if (((prev_syntax_id != syntax_seqnr && (syntax_flags & HL_CONCEAL) != 0)
+ || has_match_conc > 1 || decor_conceal > 1)
&& (syn_get_sub_char() != NUL
|| (has_match_conc && match_conc)
|| (decor_conceal && decor_state.conceal_char)
diff --git a/src/nvim/testdir/test_matchadd_conceal.vim b/src/nvim/testdir/test_matchadd_conceal.vim
index 29a2c30b0d..1b5fc8313f 100644
--- a/src/nvim/testdir/test_matchadd_conceal.vim
+++ b/src/nvim/testdir/test_matchadd_conceal.vim
@@ -335,6 +335,25 @@ func Test_matchadd_and_syn_conceal()
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
endfunc
+func Test_interaction_matchadd_syntax()
+ 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