diff options
| author | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2025-07-16 21:41:23 +0100 |
|---|---|---|
| committer | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2025-07-22 13:36:33 +0100 |
| commit | 0bef1c88f3621e185b3e35f361a418b8b36ee010 (patch) | |
| tree | 9e26e9bd0fb92917a18386ea423764e46f33503c /runtime/lua/vim/provider/python.lua | |
| parent | 9813c00dd376c00c382aaf0a8f0a6d0f45ba2a5d (diff) | |
| download | rneovim-0bef1c88f3621e185b3e35f361a418b8b36ee010.tar.gz rneovim-0bef1c88f3621e185b3e35f361a418b8b36ee010.tar.bz2 rneovim-0bef1c88f3621e185b3e35f361a418b8b36ee010.zip | |
fix(api): do not allow opening float to closing buffer
Problem: no check for nvim_open_win opening a new floating window into a closing
buffer, which can lead to crashes.
Solution: call check_split_disallowed; opening a new float semantically splits
from a window, so the same problems as regular splits apply. Also restore the
error if switch_win_noblock in win_set_buf fails (may not be possible to hit
this, but win_set_buf can silently succeed there since #31595).
As the lock check applies to curbuf (not the target buffer) this may feel a bit
restrictive, though this isn't different to how things like ":split" or
nvim_open_win with "split = true" works when targeting a different buffer. Only
checking the target buffer's lock will cause issues if win_set_buf doesn't end
up in the target buffer for whatever reason.
Maybe we could consider checking the lock of the buffer after win_set_buf and
close the window if it's locked (maybe a bit fiddly, especially as closing a
window can fail...), or make the open + switch operation more atomic, like how
Vim does for its popup windows..?
It also used to be the case that win_set_buf would set an error if autocommands
sent us to a different buffer than what was requested, but #31595 appears to
have also changed that... I haven't touched that here.
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions