@@ -10,6 +10,7 @@ let g:sneak#target_labels = get(g:, 'sneak#target_labels', ";sftunq/SFGHLTUNRMQZ
1010let s: clear_syntax = ! has (' patch-7.4.792' )
1111let s: matchmap = {}
1212let s: match_ids = []
13+ let s: orig_conceal_matches = []
1314
1415func ! s: placematch (c , pos) abort
1516 let s: matchmap [a: c ] = a: pos
@@ -22,6 +23,25 @@ func! s:placematch(c, pos) abort
2223 endif
2324endf
2425
26+ func ! s: save_conceal_matches () abort
27+ for m in getmatches ()
28+ if m .group == # ' Conceal'
29+ call add (s: orig_conceal_matches , m )
30+ silent ! call matchdelete (m .id)
31+ endif
32+ endfor
33+ endf
34+
35+ func ! s: restore_conceal_matches () abort
36+ for m in s: orig_conceal_matches
37+ let d = {}
38+ if has_key (m , ' conceal' ) | let d .conceal = m .conceal | endif
39+ if has_key (m , ' window' ) | let d .window = m .window | endif
40+ silent ! call matchadd (m .group, m .pattern, m .priority, m .id, d )
41+ endfor
42+ let s: orig_conceal_matches = []
43+ endf
44+
2545func ! sneak#label#to (s , v , label ) abort
2646 let seq = " "
2747 while 1
@@ -101,6 +121,7 @@ func! s:after() abort
101121 let s: match_ids = []
102122 " remove temporary highlight links
103123 exec ' hi! link Conceal ' .s: orig_hl_conceal
124+ call s: restore_conceal_matches ()
104125 exec ' hi! link Sneak ' .s: orig_hl_sneak
105126
106127 if s: clear_syntax
@@ -161,6 +182,7 @@ func! s:before() abort
161182 endif
162183
163184 let s: orig_hl_conceal = sneak#util#links_to (' Conceal' )
185+ call s: save_conceal_matches ()
164186 let s: orig_hl_sneak = sneak#util#links_to (' Sneak' )
165187 " set temporary link to our custom 'conceal' highlight
166188 hi ! link Conceal SneakLabel
0 commit comments