aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/func_attr.h
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-04-20 21:17:25 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2023-07-05 08:31:52 +0100
commit77118d0da8badc4135be430f4cbb15bc95bc760f (patch)
treee1168e881f49751b807524559720e5212661244e /src/nvim/func_attr.h
parentb2e8c0df2062f765a4cf7d96379c5f0f19393dfd (diff)
downloadrneovim-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/func_attr.h')
-rw-r--r--src/nvim/func_attr.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h
index 57e5766f67..9ac4ee28d6 100644
--- a/src/nvim/func_attr.h
+++ b/src/nvim/func_attr.h
@@ -226,8 +226,10 @@
# define FUNC_API_REMOTE_ONLY
/// API function not exposed in Vimscript/remote.
# define FUNC_API_LUA_ONLY
-/// API function checked textlock.
-# define FUNC_API_CHECK_TEXTLOCK
+/// API function fails during textlock.
+# define FUNC_API_TEXTLOCK
+/// API function fails during textlock, but allows cmdwin.
+# define FUNC_API_TEXTLOCK_ALLOW_CMDWIN
/// API function introduced at the given API level.
# define FUNC_API_SINCE(X)
/// API function deprecated since the given API level.