diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2023-04-20 21:17:25 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2023-07-05 08:31:52 +0100 |
commit | 77118d0da8badc4135be430f4cbb15bc95bc760f (patch) | |
tree | e1168e881f49751b807524559720e5212661244e /src/nvim/api/window.c | |
parent | b2e8c0df2062f765a4cf7d96379c5f0f19393dfd (diff) | |
download | rneovim-77118d0da8badc4135be430f4cbb15bc95bc760f.tar.gz rneovim-77118d0da8badc4135be430f4cbb15bc95bc760f.tar.bz2 rneovim-77118d0da8badc4135be430f4cbb15bc95bc760f.zip |
fix(api): use text_locked() to check textlock
Problem: some API functions that check textlock (usually those that can change
curwin or curbuf) can break the cmdwin.
Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already
checks for textlock, cmdwin and `<expr>` status.
Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the
cmdwin if they can work properly there; the opt-in nature of this attribute
should hopefully help mitigate future bugs.
Also fix a regression in #22634 that made functions checking textlock usable in
`<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
Diffstat (limited to 'src/nvim/api/window.c')
-rw-r--r-- | src/nvim/api/window.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index e5a824fec9..5fb07ecbc8 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -48,7 +48,7 @@ Buffer nvim_win_get_buf(Window window, Error *err) /// @param[out] err Error details, if any void nvim_win_set_buf(Window window, Buffer buffer, Error *err) FUNC_API_SINCE(5) - FUNC_API_CHECK_TEXTLOCK + FUNC_API_TEXTLOCK { win_set_buf(window, buffer, false, err); } @@ -351,7 +351,7 @@ Boolean nvim_win_is_valid(Window window) /// @param[out] err Error details, if any void nvim_win_hide(Window window, Error *err) FUNC_API_SINCE(7) - FUNC_API_CHECK_TEXTLOCK + FUNC_API_TEXTLOCK { win_T *win = find_window_by_handle(window, err); if (!win) { @@ -383,7 +383,7 @@ void nvim_win_hide(Window window, Error *err) /// @param[out] err Error details, if any void nvim_win_close(Window window, Boolean force, Error *err) FUNC_API_SINCE(6) - FUNC_API_CHECK_TEXTLOCK + FUNC_API_TEXTLOCK_ALLOW_CMDWIN { win_T *win = find_window_by_handle(window, err); if (!win) { |