mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
3159a2c28f
Problem: With vim.treesitter.foldexpr, `o`-ing two lines above a folded region opens the fold. This does not happen with legacy foldexprs. For example, make a markdown file with the following text (without indentation), enable treesitter fold, and follow the instruction in the text. put cursor on this line and type zoo<Esc> initially folded, revealed by zo # then this fold will be opened initially folded, revealed by o<Esc> Analysis: * `o` updates folds first (done in `changed_lines`), evaluating foldexpr, and then invokes `on_bytes` (done in `extmark_splice`). * Treesitter fold allocates the foldinfo for added lines (`add_range`) on `on_bytes`. * Therefore, when treesitter foldexpr is invoked while running `o`, it sees outdated foldinfo. Solution: `extmark_splice`, and then `changed_lines`. This seems to be the standard order in other places, e.g., `nvim_buf_set_lines`. |
||
---|---|---|
.. | ||
api_spec.lua | ||
base64_spec.lua | ||
buffer_updates_spec.lua | ||
command_line_completion_spec.lua | ||
commands_spec.lua | ||
diagnostic_spec.lua | ||
ffi_spec.lua | ||
filetype_spec.lua | ||
fs_spec.lua | ||
help_spec.lua | ||
highlight_spec.lua | ||
inspector_spec.lua | ||
iter_spec.lua | ||
json_spec.lua | ||
loader_spec.lua | ||
loop_spec.lua | ||
luaeval_spec.lua | ||
mpack_spec.lua | ||
overrides_spec.lua | ||
runtime_spec.lua | ||
secure_spec.lua | ||
snippet_spec.lua | ||
spell_spec.lua | ||
system_spec.lua | ||
text_spec.lua | ||
thread_spec.lua | ||
ui_event_spec.lua | ||
ui_spec.lua | ||
uri_spec.lua | ||
version_spec.lua | ||
vim_spec.lua | ||
watch_spec.lua | ||
xdiff_spec.lua |