mirror of
https://github.com/neovim/neovim
synced 2025-07-17 17:51:48 +00:00
fix(treesitter.foldexpr): refresh in the buffers affected by OptionSet
This commit is contained in:
@ -430,9 +430,13 @@ api.nvim_create_autocmd('OptionSet', {
|
|||||||
pattern = { 'foldminlines', 'foldnestmax' },
|
pattern = { 'foldminlines', 'foldnestmax' },
|
||||||
desc = 'Refresh treesitter folds',
|
desc = 'Refresh treesitter folds',
|
||||||
callback = function()
|
callback = function()
|
||||||
for bufnr, _ in pairs(foldinfos) do
|
local bufs = vim.v.option_type == 'local' and { api.nvim_get_current_buf() }
|
||||||
|
or vim.tbl_keys(foldinfos)
|
||||||
|
for _, bufnr in ipairs(bufs) do
|
||||||
foldinfos[bufnr] = FoldInfo.new()
|
foldinfos[bufnr] = FoldInfo.new()
|
||||||
compute_folds_levels(bufnr, foldinfos[bufnr])
|
api.nvim_buf_call(bufnr, function()
|
||||||
|
compute_folds_levels(bufnr, foldinfos[bufnr])
|
||||||
|
end)
|
||||||
foldinfos[bufnr]:foldupdate(bufnr, 0, api.nvim_buf_line_count(bufnr))
|
foldinfos[bufnr]:foldupdate(bufnr, 0, api.nvim_buf_line_count(bufnr))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Reference in New Issue
Block a user