Fix: Folding code blocks using markdown syntax folds the entire rest of the file (#1323)

This commit is contained in:
Tinmarino
2023-10-31 12:40:39 -03:00
parent 68664e5d72
commit 90b23b466f
2 changed files with 53 additions and 2 deletions
+8 -2
View File
@@ -196,9 +196,15 @@ function! VimwikiFoldLevel(lnum) abort
endif
" Code block folding...
if line =~# vimwiki#vars#get_syntaxlocal('rxPreStart')
" -- previously it would always increment when it saw a ```, so we never left the code block. (See #1323)
let prevline = getline(v:lnum - 1)
let nextline = getline(v:lnum + 1)
" -- Start: assumes empty line before
if line =~# vimwiki#vars#get_syntaxlocal('rxPreStart') && prevline =~ '^\s*$'
return 'a1'
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd')
" -- End: assumes empty line after
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd') && nextline =~ '^\s*$'
return 's1'
endif