diff options
| author | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2026-03-15 10:18:31 +0000 |
|---|---|---|
| committer | Sean Dewar <6256228+seandewar@users.noreply.github.com> | 2026-03-16 13:05:47 +0000 |
| commit | cd4c98fded9490378bdb33966d14773242941905 (patch) | |
| tree | 88575327432f84e1a9528067e61b44403c269857 /runtime/lua/vim/_meta/api.lua | |
| parent | e80d19142bdb7b2856ef304f3a5ae05d22ba6532 (diff) | |
| download | rneovim-cd4c98fded9490378bdb33966d14773242941905.tar.gz rneovim-cd4c98fded9490378bdb33966d14773242941905.tar.bz2 rneovim-cd4c98fded9490378bdb33966d14773242941905.zip | |
fix: nvim_open_tabpage cleanup, fixes, more tests
- Cleanup, remove redundant comments, add more tests.
- Enhance win_new_tabpage rather than create a new function for !enter, and use
a different approach that minimizes side-effects. Return the tabpage_T * and
first win_T * it allocated.
- Disallow during textlock, like other APIs that open windows.
- Remove existing win_alloc_firstwin error handling from win_new_tabpage; it's
not needed, and looks incorrect. (enter_tabpage is called for curtab, which is
not the old tabpage! Plus newtp is not freed)
- Fix checks after creating the tabpage:
- Don't fail if buf wasn't set successfully; the tab page may still be valid
regardless. Set buffer like nvim_open_win, possibly blocking Enter/Leave
events. (except BufWinEnter)
- tp_curwin may not be the initial window opened by win_new_tabpage. Use the
win_T * it returns instead, which is the real first window it allocated,
regardless of autocmd shenanigans.
- Properly check whether tab page was freed; it may have also been freed
before win_set_buf. Plus, it may not be safe to read its handle!
Diffstat (limited to 'runtime/lua/vim/_meta/api.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/api.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 6be9305d48..b49a547d63 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1673,7 +1673,7 @@ function vim.api.nvim_load_context(dict) end --- @return any function vim.api.nvim_notify(msg, log_level, opts) end ---- Opens a new tabpage +--- Opens a new tabpage. --- --- @param buffer integer Buffer to open in the first window of the new tabpage. --- Use 0 for current buffer. |