diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2024-06-20 22:37:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 06:37:09 -0700 |
commit | 0e3e1e6b6d8370f1fcc9887d5cb931b131450a1c (patch) | |
tree | 6d963175f6aab06874952e0ba692cf65a9ca083e /runtime/lua/vim/treesitter/_fold.lua | |
parent | b923fcbaf06276051372c17177a9970c4adc8e3d (diff) | |
download | rneovim-0e3e1e6b6d8370f1fcc9887d5cb931b131450a1c.tar.gz rneovim-0e3e1e6b6d8370f1fcc9887d5cb931b131450a1c.tar.bz2 rneovim-0e3e1e6b6d8370f1fcc9887d5cb931b131450a1c.zip |
fix(treesitter): don't open fold when o/O adds a line below #28709
Problem:
`o`-ing on a folded line opens the fold, because the new line gets the
fold level from the above line (level '='), which extends the fold to
the new line. `O` has a similar problem when run on the line below a
fold.
Solution:
Use -1 for the added line to get the lower level from the above/below
line.
Diffstat (limited to 'runtime/lua/vim/treesitter/_fold.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/_fold.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua index 04a3c62cf1..b8f1ef1282 100644 --- a/runtime/lua/vim/treesitter/_fold.lua +++ b/runtime/lua/vim/treesitter/_fold.lua @@ -87,7 +87,7 @@ end ---@param srow integer ---@param erow integer 0-indexed, exclusive function FoldInfo:add_range(srow, erow) - list_insert(self.levels, srow + 1, erow, '=') + list_insert(self.levels, srow + 1, erow, -1) list_insert(self.levels0, srow + 1, erow, -1) end |