mirror of
https://github.com/vim/vim.git
synced 2025-10-02 05:04:20 -04:00
patch 8.2.2271: ml_get error when changing hidden buffer in Python
Problem: ml_get error when changing hidden buffer in Python. Solution: Block updating folds. (closes #7598)
This commit is contained in:
@@ -4016,4 +4016,37 @@ func Test_python3_non_utf8_string()
|
||||
sunmap <Esc>@
|
||||
endfunc
|
||||
|
||||
func Test_python3_fold_hidden_buffer()
|
||||
CheckFeature folding
|
||||
|
||||
set fdm=expr fde=Fde(v:lnum)
|
||||
let b:regex = '^'
|
||||
func Fde(lnum)
|
||||
let ld = [{}]
|
||||
let lines = bufnr('%')->getbufline(1, '$')
|
||||
let was_import = 0
|
||||
for lnum in range(1, len(lines))
|
||||
let line = lines[lnum]
|
||||
call add(ld, {'a': b:regex})
|
||||
let ld[lnum].foldexpr = was_import ? 1 : '>1'
|
||||
let was_import = 1
|
||||
endfor
|
||||
return ld[a:lnum].foldexpr
|
||||
endfunc
|
||||
|
||||
call setline(1, repeat([''], 15) + repeat(['from'], 3))
|
||||
eval repeat(['x'], 17)->writefile('Xa.txt')
|
||||
split Xa.txt
|
||||
py3 import vim
|
||||
py3 b = vim.current.buffer
|
||||
py3 aaa = b[:]
|
||||
hide
|
||||
py3 b[:] = aaa
|
||||
|
||||
call delete('Xa.txt')
|
||||
set fdm& fde&
|
||||
delfunc Fde
|
||||
bwipe! Xa.txt
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Reference in New Issue
Block a user