aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-12-05 09:40:48 +0900
committerGitHub <noreply@github.com>2023-12-05 08:40:48 +0800
commit3159a2c28f5ea8797cb525c74dedd622bfe4a0a1 (patch)
tree0fa25e011924f8854122addb9a28e4c6b7b34d64 /test/functional/lua/buffer_updates_spec.lua
parentc3836e40a2bffbc1d4e06531145b7825788dd818 (diff)
downloadrneovim-3159a2c28f5ea8797cb525c74dedd622bfe4a0a1.tar.gz
rneovim-3159a2c28f5ea8797cb525c74dedd622bfe4a0a1.tar.bz2
rneovim-3159a2c28f5ea8797cb525c74dedd622bfe4a0a1.zip
fix(change): update fold after on_bytes (#26364)
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`.
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 51e4548edb..a3f637e4de 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -418,7 +418,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
-- meths.set_option_value('autoindent', true, {})
feed 'Go'
check_events {
- { "test1", "bytes", 1, 4, 7, 0, 114, 0, 0, 0, 1, 0, 1 };
+ { "test1", "bytes", 1, 3, 7, 0, 114, 0, 0, 0, 1, 0, 1 };
}
feed '<cr>'
check_events {
@@ -431,7 +431,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
meths.set_option_value('autoindent', true, {})
feed 'Go'
check_events {
- { "test1", "bytes", 1, 4, 7, 0, 114, 0, 0, 0, 1, 0, 5 };
+ { "test1", "bytes", 1, 3, 7, 0, 114, 0, 0, 0, 1, 0, 5 };
}
feed '<cr>'
check_events {
@@ -476,7 +476,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
feed 'ggo' -- goto first line to continue testing
check_events {
- { "test1", "bytes", 1, 6, 1, 0, 11, 0, 0, 0, 1, 0, 4 };
+ { "test1", "bytes", 1, 5, 1, 0, 11, 0, 0, 0, 1, 0, 4 };
}
feed '<CR>'