mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-02 01:42:42 +00:00
fix(indent): make sure cursor line is in scope for the out
style. Fixes #264
This commit is contained in:
parent
19d131523a
commit
39c009fe0b
1 changed files with 3 additions and 2 deletions
|
@ -384,9 +384,10 @@ local function step(scope, value, prev)
|
||||||
elseif style == "up" then
|
elseif style == "up" then
|
||||||
scope.animate = { from = scope.to - value, to = scope.to }
|
scope.animate = { from = scope.to - value, to = scope.to }
|
||||||
elseif style == "out" then
|
elseif style == "out" then
|
||||||
|
local line = math.min(math.max(scope.from, cursor[1]), scope.to)
|
||||||
scope.animate = {
|
scope.animate = {
|
||||||
from = math.max(scope.from, cursor[1] - value),
|
from = math.max(scope.from, line - value),
|
||||||
to = math.min(scope.to, cursor[1] + value),
|
to = math.min(scope.to, line + value),
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Snacks.notify.error("Invalid animate style: " .. style, { title = "Snacks Indent", once = true })
|
Snacks.notify.error("Invalid animate style: " .. style, { title = "Snacks Indent", once = true })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue