diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-02-02 06:14:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 13:14:10 +0800 |
commit | 4a1ad676ce0bdaead122b092d2ff33b51679ffe9 (patch) | |
tree | 43b2f09fc1e396c1d3afdc269f03f2fd8a66515f /src/nvim/lua/executor.c | |
parent | 1405e5c8c1f3b3ef59cab0ac2d0a28b9b88869cf (diff) | |
download | rneovim-4a1ad676ce0bdaead122b092d2ff33b51679ffe9.tar.gz rneovim-4a1ad676ce0bdaead122b092d2ff33b51679ffe9.tar.bz2 rneovim-4a1ad676ce0bdaead122b092d2ff33b51679ffe9.zip |
feat(ex_cmds): no error on :lua with {range} and {code} (#27290)
Problem: Erroring when both {range} and {code} are supplied to
:lua is inconvenient and may break mappings.
Solution: Don't error, ignore {range} and execute {code} when both
are supplied.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 5d51d58b1d..85d614fe0d 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1649,12 +1649,12 @@ bool nlua_is_deferred_safe(void) void ex_lua(exarg_T *const eap) FUNC_ATTR_NONNULL_ALL { - // ":{range}lua" - if (eap->addr_count > 0 || *eap->arg == NUL) { - if (eap->addr_count > 0 && *eap->arg == NUL) { + // ":{range}lua", only if no {code} + if (*eap->arg == NUL) { + if (eap->addr_count > 0) { cmd_source_buffer(eap, true); } else { - semsg(_(e_invarg2), "exactly one of {chunk} or {range} required"); + emsg(_(e_argreq)); } return; } |