Skip to content

Commit

Permalink
fix(animate): don't animate terminal windows since it conflicts with …
Browse files Browse the repository at this point in the history
…reflow and can cause segfaults. Fixes #23
  • Loading branch information
folke committed Jun 16, 2023
1 parent ab09d4f commit 408d053
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lua/edgy/animate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ function M.step(win, step)
step = step or (Config.animate.cps / Config.animate.fps)
local state = M.get_state(win)
local updated = false
local buf = vim.api.nvim_win_get_buf(win.win)
for _, key in ipairs({ "width", "height" }) do
local current = vim.api["nvim_win_get_" .. key](win.win)
if win[key] and state[key] ~= win[key] then
if state[key] > win[key] then
state[key] = math.max(state[key] - step, win[key])
else
state[key] = math.min(state[key] + step, win[key])
if vim.bo[buf].buftype == "terminal" then
state[key] = win[key]
else
if win[key] and state[key] ~= win[key] then
if state[key] > win[key] then
state[key] = math.max(state[key] - step, win[key])
else
state[key] = math.min(state[key] + step, win[key])
end
end
end
if current ~= state[key] then
Expand Down

0 comments on commit 408d053

Please sign in to comment.