Bram,
the attached patch fixes #1092. This happens since patch 7.4.792 which
resets prev_syntax_id to zero, whenever a match ends within a portion of
concealed text. I think that part was not supposed to be there from the
beginning, so remove it. I attache a test for checking the result.
Best,
Christian
--
Aschenhaufen haben es gern, wenn man sie für erloschene Vulkane hält.
-- Wieslaw Brudzinski
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
From 594bcfbfbba66eb530e2be745ca9ffda2820e851 Mon Sep 17 00:00:00 2001
From: Christian Brabandt <[email protected]>
Date: Sun, 23 Oct 2016 13:34:21 +0200
Subject: [PATCH] Fix Conceal mode getting confused from matchadd()
When a match ends in part of concealed text highlighting, it might mess
up concealing by resetting prev_syntax_id. This is certainly wrong.
Therefore, do not reset prev_syntax_id and add a test to verify
fixes #1092
---
src/screen.c | 3 ---
src/testdir/test_matchadd_conceal.vim | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/screen.c b/src/screen.c
index 78f89eb..c98d567 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3981,9 +3981,6 @@ win_line(
else if (v == (long)shl->endcol)
{
shl->attr_cur = 0;
-#ifdef FEAT_CONCEAL
- prev_syntax_id = 0;
-#endif
next_search_hl(wp, shl, lnum, (colnr_T)v,
shl == &search_hl ? NULL : cur);
pos_inprogress = cur == NULL || cur->pos.cur == 0
diff --git a/src/testdir/test_matchadd_conceal.vim b/src/testdir/test_matchadd_conceal.vim
index 5da2816..610917f 100644
--- a/src/testdir/test_matchadd_conceal.vim
+++ b/src/testdir/test_matchadd_conceal.vim
@@ -264,3 +264,25 @@ function! Test_matchadd_repeat_conceal_with_syntax_off()
quit!
endfunction
+
+function! Test_matchadd_and_syn_conceal()
+ new
+ let cnt='Inductive bool : Type := | true : bool | false : bool.'
+ let expect = 'Inductive - : Type := | true : - | false : -.'
+ 0put =cnt
+ " set filetype and :syntax on to change screenattr()
+ set cole=1 cocu=nv
+ hi link CheckedByCoq WarningMsg
+ syntax on
+ syntax keyword coqKwd bool conceal cchar=-
+ redraw!
+ call assert_equal(expect, s:screenline(1))
+ call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
+ call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
+ call assert_equal(screenattr(1, 11) , screenattr(1, 32))
+ call matchadd('CheckedByCoq', '\%<2l\%>9c\%<16c')
+ call assert_equal(expect, s:screenline(1))
+ call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
+ call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
+ call assert_equal(screenattr(1, 11) , screenattr(1, 32))
+endfunction
--
2.9.3