mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 13:45:15 -07:00
a70eae57bd
Problem: nvim_open_win blocking all win_set_buf autocommands when !enter && !noautocmd is too aggressive. Solution: temporarily block WinEnter/Leave and BufEnter/Leave events when setting the buffer. Delegate the firing of BufWinEnter back to win_set_buf, which also has the advantage of keeping the timing consistent (e.g: before the epilogue in enter_buffer, which also handles restoring the cursor position if autocommands didn't change it, among other things). Reword the documentation for noautocmd a bit. I pondered modifying do_buffer and callees to allow for BufEnter/Leave being conditionally disabled, but it seems too invasive (and potentially error-prone, especially if new code paths to BufEnter/Leave are added in the future). Unfortunately, doing this has the drawback of blocking ALL such events for the duration, which also means blocking unrelated such events; like if window switching occurs in a ++nested autocmd fired by win_set_buf. If this turns out to be a problem in practice, a different solution specialized for nvim_open_win could be considered. :-) |
||
---|---|---|
.. | ||
api | ||
autocmd | ||
core | ||
editor | ||
ex_cmds | ||
fixtures | ||
legacy | ||
lua | ||
options | ||
plugin | ||
provider | ||
script | ||
shada | ||
terminal | ||
treesitter | ||
ui | ||
vimscript | ||
example_spec.lua | ||
helpers.lua | ||
preload.lua |