aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorSean Dewar <6256228+seandewar@users.noreply.github.com>2024-04-15 00:10:16 +0100
committerGitHub <noreply@github.com>2024-04-14 16:10:16 -0700
commit7180ef690180cf92d1d49811820c46dd60e4d1c6 (patch)
treefd3a3167aa497c37501075a7814820d9507d0e76 /runtime/doc
parente3fb937545f736ac33a783a0ef2bbe2927a68ef4 (diff)
downloadrneovim-7180ef690180cf92d1d49811820c46dd60e4d1c6.tar.gz
rneovim-7180ef690180cf92d1d49811820c46dd60e4d1c6.tar.bz2
rneovim-7180ef690180cf92d1d49811820c46dd60e4d1c6.zip
feat(api)!: nvim_open_win: noautocmd blocks all autocmds #28192
Problem: noautocmd is confusing; despite its name, it doesn't block all autocommands (instead it blocks only those related to setting the buffer), and is commonly used by plugins to open windows while producing minimal side-effects. Solution: be consistent and block all autocommands when noautocmd is set. This includes WinNew (again), plus autocommands from entering the window (if enter is set) like WinEnter, WinLeave, TabEnter, .etc. See the discussion at https://github.com/neovim/neovim/pull/14659#issuecomment-2040029517 for more information. Remove win_set_buf's noautocmd argument, as it's no longer needed. NOTE: pum_create_float_preview sets noautocmd for win_set_buf, but all its callers already use block_autocmds. Despite that, pum_create_float_preview doesn't actually properly handle autocommands (it has no checks for whether those from win_enter or nvim_create_buf free the window). For now, ensure autocommands are blocked within it for correctness (in case it's ever called outside of a block_autocmds context; the function seems to have been refactored in #26739 anyway).
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/api.txt5
-rw-r--r--runtime/doc/news.txt3
2 files changed, 5 insertions, 3 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index bf56a09ac7..91b80601da 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -3271,9 +3271,8 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
• footer_pos: Footer position. Must be set with `footer`
option. Value can be one of "left", "center", or "right".
Default is `"left"`.
- • noautocmd: If true then autocommands triggered from
- setting the `buffer` to display are blocked (e.g:
- |BufEnter|, |BufLeave|, |BufWinEnter|).
+ • noautocmd: If true then all autocommands are blocked for
+ the duration of the call.
• fixed: If true when anchor is NW or SW, the float window
would be kept fixed even if the window would be truncated.
• hide: If true the floating window will be hidden.
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 15bdfb52f6..ae5f808a9c 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -137,6 +137,9 @@ The following changes may require adaptations in user config or plugins.
• |:TOhtml| has been rewritten in Lua to support Neovim-specific decorations,
and many options have been removed.
+• |nvim_open_win()| now blocks all autocommands when `noautocmd` is set,
+ rather than just those from setting the `buffer` to display in the window.
+
==============================================================================
BREAKING CHANGES IN HEAD *news-breaking-dev*