mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 03:56:52 -04:00
fix(folds): always fold more than one line
This commit is contained in:
parent
03bb038c70
commit
41ed83ffc7
1 changed files with 3 additions and 1 deletions
|
|
@ -30,9 +30,11 @@ local folds_levels = tsutils.memoize_by_buf_tick(function(bufnr)
|
|||
stop = stop + 1
|
||||
end
|
||||
|
||||
local should_fold = start + 1 > stop -- Only fold for 2+ lines
|
||||
|
||||
-- This can be folded
|
||||
-- Fold only multiline nodes that are not exactly the same as previously met folds
|
||||
if start ~= stop and not (levels_tmp[start] and levels_tmp[stop]) then
|
||||
if should_fold and not (levels_tmp[start] and levels_tmp[stop]) then
|
||||
levels_tmp[start] = (levels_tmp[start] or 0) + 1
|
||||
levels_tmp[stop] = (levels_tmp[stop] or 0) - 1
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue