mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(indent): when at edge of two blocks, prefer the one below. See #231
This commit is contained in:
parent
6ee9e4e71d
commit
2457d913dc
1 changed files with 6 additions and 0 deletions
|
@ -232,11 +232,17 @@ function IndentScope:find(opts)
|
|||
|
||||
-- adjust line to the nearest indent block
|
||||
if prev_i <= indent and next_i > indent then
|
||||
-- at top edge
|
||||
line = next_l
|
||||
indent = next_i
|
||||
elseif next_i <= indent and prev_i > indent then
|
||||
-- at bottom edge
|
||||
line = prev_l
|
||||
indent = prev_i
|
||||
elseif next_i > indent and prev_i > indent then
|
||||
-- at edge of two blocks. Prefer the one below.
|
||||
line = next_l
|
||||
indent = next_i
|
||||
end
|
||||
|
||||
-- expand to include bigger indents
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue