[vim/vim] Syntax concealing not rendered when foldmethod=diff has closed folds (Issue #19423)

3 views
Skip to first unread message

sideshowbarker

unread,
1:50 AM (8 hours ago) 1:50 AM
to vim/vim, Subscribed
sideshowbarker created an issue (vim/vim#19423)

Problem

Syntax concealing does not render on visible (unfolded) lines when foldmethod=diff is active and some folds are closed. The conceal rules are correctly defined and conceallevel is set, but the concealed text is displayed literally.

Opening all folds (zR), forcing a redraw, then re-closing them (zM) causes concealing to render correctly.

Steps to reproduce

set nocompatible
syntax on

enew
setlocal buftype=nofile bufhidden=wipe
call setline(1, [
  \ 'Same 1', 'Same 2', 'Same 3',
  \ 'Left only [visible](http://hidden-url)',
  \ 'Same 5', 'Same 6',
  \ ])
setlocal syntax=markdown conceallevel=2
diffthis

vnew
setlocal buftype=nofile bufhidden=wipe
call setline(1, [
  \ 'Same 1', 'Same 2', 'Same 3',
  \ 'Right only [visible](http://hidden-url)',
  \ 'Same 5', 'Same 6',
  \ ])
setlocal syntax=markdown conceallevel=2
diffthis

Expected behavior

Line 4 in both buffers should show the markdown link with the URL concealed (i.e., just “visible” instead of “visible”).

Actual behavior

Line 4 shows the raw markdown [visible](http://hidden-url) with no concealing applied, even though conceallevel=2 and the syntax conceal rules are active.

Workaround

After diffthis, running zR (open all folds), redraw, then zM (close all folds) causes concealing to render correctly. This can be automated with a deferred callback:

timer_start(50, (_) => {
  normal! zR
  redraw
  normal! zM
})

The redraw between zR and zM is essential — without it, the workaround has no effect.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423@github.com>

zeertzjq

unread,
4:21 AM (5 hours ago) 4:21 AM
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19423)

The conceal rules are correctly defined

Where do the conceal rules come from? The builtin markdown syntax file doesn't conceal URLs.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907314990@github.com>

sideshowbarker

unread,
4:53 AM (5 hours ago) 4:53 AM
to vim/vim, Subscribed
sideshowbarker left a comment (vim/vim#19423)

The conceal rules come from preservim/vim-markdown, which provides a syntax/markdown.vim that includes conceal on inline link URLs and other elements. The built-in syntax file doesn't conceal, correct.

But the bug isn't specific to any particular conceal rules — it's that foldmethod=diff with closed folds prevents any syntax concealing from rendering on visible (unfolded) lines. Here's a self-contained reproduction using a custom syntax rule with no plugins:

set nocompatible
syntax on

" Left buffer
enew
setlocal buftype=nofile bufhidden=wipe
call setline(1, ['Same 1', 'Same 2', 'Same 3', 'Left SECRET here', 'Same 5', 'Same 6'])
syntax match MySecret /SECRET/ conceal
setlocal conceallevel=2
diffthis

" Right buffer
vnew
setlocal buftype=nofile bufhidden=wipe
call setline(1, ['Same 1', 'Same 2', 'Same 3', 'Right SECRET here', 'Same 5', 'Same 6'])
syntax match MySecret /SECRET/ conceal
setlocal conceallevel=2
diffthis

Expected: SECRET is concealed on line 4 in both buffers.
Actual: SECRET is shown literally. Running zR then zM makes concealing appear.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907491150@github.com>

zeertzjq

unread,
5:09 AM (4 hours ago) 5:09 AM
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19423)

Cannot reproduce. The script doesn't lead to any closed folds.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907575377@github.com>

sideshowbarker

unread,
5:15 AM (4 hours ago) 5:15 AM
to vim/vim, Subscribed
sideshowbarker left a comment (vim/vim#19423)

Updated the reproduction script — the previous one had too few lines to form closed folds. Here's an updated version with enough unchanged lines:

set nocompatible
syntax on

let shared_before = map(range(1, 20), '"Same " .. v:val')
let shared_after = map(range(1, 20), '"After " .. v:val')

" Left buffer
enew
setlocal buftype=nofile bufhidden=wipe
call setline(1, shared_before + ['Left SECRET here'] + shared_after)
syntax match MySecret /SECRET/ conceal
setlocal conceallevel=2
diffthis

" Right buffer
vnew
setlocal buftype=nofile bufhidden=wipe
call setline(1, shared_before + ['Right SECRET here'] + shared_after)
syntax match MySecret /SECRET/ conceal
setlocal conceallevel=2
diffthis

With 20 unchanged lines on each side, foldmethod=diff creates closed folds. Line 21 (the changed line) is visible but SECRET is not concealed. Running zR then zM makes concealing appear.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907599419@github.com>

Christian Brabandt

unread,
5:54 AM (4 hours ago) 5:54 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19423)

Works as expected, using vim --clean -u script.vim

image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907785734@github.com>

sideshowbarker

unread,
6:03 AM (3 hours ago) 6:03 AM
to vim/vim, Subscribed
sideshowbarker left a comment (vim/vim#19423)

Works as expected, using vim --clean -u script.vim

OK, yeah, I can’t reproduce it with --clean, either.

So I guess there’s something else going on in my environment — and given that, I’m gonna close this and regroup and try to further isolate the problem.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907827439@github.com>

sideshowbarker

unread,
6:03 AM (3 hours ago) 6:03 AM
to vim/vim, Subscribed

Closed #19423 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/19423/issue_event/22821807661@github.com>

sideshowbarker

unread,
6:08 AM (3 hours ago) 6:08 AM
to vim/vim, Subscribed
sideshowbarker left a comment (vim/vim#19423)

And now I realize I should have rightly closed this as “not planned / can’t repro”. But it seems the repo perms don’t allow me to reopen it. So please re-open and re-close it as such — if the normal project policy/convention is to do that.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19423/3907851592@github.com>

zeertzjq

unread,
6:12 AM (3 hours ago) 6:12 AM
to vim/vim, Subscribed

Closed #19423 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/19423/issue_event/22822016731@github.com>

Reply all
Reply to author
Forward
0 new messages