diff options
author | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2024-02-26 14:51:31 +0000 |
---|---|---|
committer | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2024-03-08 23:24:05 +0000 |
commit | d942c2b9432d81e4b509519bd48fa886e37e9ca8 (patch) | |
tree | e4318cabfd0461854051794ce2e903eb5dbcbe80 /test/functional/api/tabpage_spec.lua | |
parent | 832bc5c169d8b339ef139ef0bdcefb2e72864e6e (diff) | |
download | rneovim-d942c2b9432d81e4b509519bd48fa886e37e9ca8.tar.gz rneovim-d942c2b9432d81e4b509519bd48fa886e37e9ca8.tar.bz2 rneovim-d942c2b9432d81e4b509519bd48fa886e37e9ca8.zip |
fix(api): handle win_split_ins failure properly
Problem: nvim_win_set_config does not handle failure in win_split_ins properly
yet, which can cause all sorts of issues. Also nvim_open_win and
nvim_win_set_config do not set the error message to the one from win_split_ins.
Solution: handle failure by undoing winframe_remove, like in win_splitmove.
Make sure autocommands from switching to the altwin fire within a valid window,
and ensure they don't screw things up. Set the error message to that of
win_split_ins, if any.
Also change a few other small things, including:
- adjust win_append to take a tabpage_T * argument, which is more consistent
with win_remove (and also allows us to undo a call to win_remove).
- allow winframe_restore to restore window positions. Useful if `wp` was in a
different tabpage, as a call to win_comp_pos (which only works for the current
tabpage) after winframe_restore should no longer be needed.
Though enter_tabpage calls win_comp_pos anyway, this has the advantage of
ensuring w_winrow/col remains accurate even before entering the tabpage
(useful for stuff like win_screenpos, if used on a window in another tabpage).
(This change should probably also be PR'd to Vim later, even though it doesn't
use winframe_restore for a `wp` in a different tabpage yet).
Diffstat (limited to 'test/functional/api/tabpage_spec.lua')
0 files changed, 0 insertions, 0 deletions