Files
neovim/runtime/lua/vim
Sean Dewar a70eae57bd fix(api): make open_win block only enter/leave events if !enter && !noautocmd
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. :-)
2024-03-08 23:24:04 +00:00
..
2024-02-21 06:29:53 +08:00
2023-09-20 13:42:41 +01:00
2024-03-06 10:45:22 +00:00
2024-03-06 10:45:22 +00:00
2024-03-06 10:45:22 +00:00
2024-03-06 10:57:21 +00:00
2024-01-16 09:33:10 +00:00
2024-03-06 21:56:47 +00:00
2023-09-20 13:42:41 +01:00
2024-01-19 11:54:04 +00:00
2024-02-27 14:41:17 +00:00
2024-02-27 14:41:17 +00:00
2024-03-06 10:45:22 +00:00
2024-03-06 16:03:33 +00:00