mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(util): fix invalid window error (#1996)
## Description Add check if win id is valid to prevent errors when opening buffers using Harpoon, or Diffview. ## Related Issue(s) - Fixes #1968 ## Screenshots <img width="1391" alt="image" src="https://github.com/user-attachments/assets/daa8cbd1-7104-4c5d-8cae-d50a900b6c76" /> <img width="1690" alt="image" src="https://github.com/user-attachments/assets/6dd9cae6-fc3f-4a5e-b5ae-6fc1e4afeeca" />
This commit is contained in:
parent
7e3c655bec
commit
32e5bf1730
1 changed files with 1 additions and 1 deletions
|
|
@ -203,7 +203,7 @@ end
|
|||
---@param from number -- 1-indexed, inclusive
|
||||
---@param to number -- 1-indexed, inclusive
|
||||
function M.redraw_range(win, from, to)
|
||||
if vim.api.nvim__redraw then
|
||||
if vim.api.nvim__redraw and vim.api.nvim_win_is_valid(win) then
|
||||
vim.api.nvim__redraw({ win = win, range = { math.floor(from - 1), math.floor(to) }, valid = true, flush = false })
|
||||
else
|
||||
vim.cmd([[redraw!]])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue