mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
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.
This commit is contained in:
@@ -310,7 +310,8 @@ param_exclude = (
|
||||
# Annotations are displayed as line items after API function descriptions.
|
||||
annotation_map = {
|
||||
'FUNC_API_FAST': '|api-fast|',
|
||||
'FUNC_API_CHECK_TEXTLOCK': 'not allowed when |textlock| is active',
|
||||
'FUNC_API_TEXTLOCK': 'not allowed when |textlock| is active or in the |cmdwin|',
|
||||
'FUNC_API_TEXTLOCK_ALLOW_CMDWIN': 'not allowed when |textlock| is active',
|
||||
'FUNC_API_REMOTE_ONLY': '|RPC| only',
|
||||
'FUNC_API_LUA_ONLY': 'Lua |vim.api| only',
|
||||
}
|
||||
|
Reference in New Issue
Block a user