fix(treesitter): foldexpr (#22652)

The ranges passed to foldinfo.remove_range were in the wrong order.
This commit is contained in:
Lewis Russell 2023-03-13 10:44:43 +00:00 committed by GitHub
parent 773febc460
commit 35799a6629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,8 +200,9 @@ end
local function on_bytes(bufnr, foldinfo, start_row, old_row, new_row)
local end_row_old = start_row + old_row
local end_row_new = start_row + new_row
if new_row < old_row then
foldinfo:remove_range(end_row_old, end_row_new)
foldinfo:remove_range(end_row_new, end_row_old)
elseif new_row > old_row then
foldinfo:add_range(start_row, end_row_new)
vim.schedule(function()