mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(image): hover close in insert mode (#2215)
## Description
I'm not 100% sure if this is a bug or if it was intentional, but the
`return` seems to have been lost from a previous refactor
e35d6cd4 (diff-ff9a4f8a621887c466394f755193cc78a5e69e0e2e86f4e668662e1434d3611eL878).
When an image displays using float or hover, the image can block the
text even in insert mode. This makes editing really hard. Adding the
`return` can close the hover in insert mode.
## Related Issue(s)
I couldn't find an issue created for this, but there is a discussion
about it https://github.com/folke/snacks.nvim/discussions/1777.
## Screenshots
Before the fix, the image shows in insert mode.
<img width="704" height="710" alt="image"
src="https://github.com/user-attachments/assets/224883d1-edbc-4f7a-8c1b-91ef00dbe21e"
/>
After the fix, the image stops showing in insert mode.
<img width="389" height="127" alt="image"
src="https://github.com/user-attachments/assets/d704d4f8-9259-4e5e-b7a9-954ea6e2a788"
/>
This commit is contained in:
parent
3b14f8c1a5
commit
ef59af0ffc
1 changed files with 5 additions and 1 deletions
|
|
@ -347,7 +347,11 @@ function M.hover()
|
|||
return
|
||||
end
|
||||
|
||||
if hover and (not hover.win:valid() or hover.buf ~= current_buf or vim.fn.mode() ~= "n") then
|
||||
if hover and (hover.buf ~= current_buf or vim.fn.mode() ~= "n") then
|
||||
return M.hover_close()
|
||||
end
|
||||
|
||||
if hover and not hover.win:valid() then
|
||||
M.hover_close()
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue