aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-17 17:44:08 +0800
committerGitHub <noreply@github.com>2023-04-17 17:44:08 +0800
commit75d9c413d49261b8f9a96f45edda0af9f0e8d947 (patch)
treedef7775f34cec1b5fabafd3f96e392a2e486ee48 /src/nvim/ex_docmd.c
parenta30e61eb4db55c68d91528b2d241424503d4e6d6 (diff)
downloadrneovim-75d9c413d49261b8f9a96f45edda0af9f0e8d947.tar.gz
rneovim-75d9c413d49261b8f9a96f45edda0af9f0e8d947.tar.bz2
rneovim-75d9c413d49261b8f9a96f45edda0af9f0e8d947.zip
fix(excmd): make :def unknown rather than unimplemented (#23150)
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 246aa0aace..b65fa086f4 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2992,6 +2992,11 @@ char *find_ex_command(exarg_T *eap, int *full)
}
assert(eap->cmdidx >= 0);
+ if (len == 3 && strncmp("def", eap->cmd, 3) == 0) {
+ // Make :def an unknown command to avoid confusing behavior. #23149
+ eap->cmdidx = CMD_SIZE;
+ }
+
for (; (int)eap->cmdidx < CMD_SIZE;
eap->cmdidx = (cmdidx_T)((int)eap->cmdidx + 1)) {
if (strncmp(cmdnames[(int)eap->cmdidx].cmd_name, eap->cmd,
@@ -3146,6 +3151,11 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
cmdidx_T excmd_get_cmdidx(const char *cmd, size_t len)
{
+ if (len == 3 && strncmp("def", cmd, 3) == 0) {
+ // Make :def an unknown command to avoid confusing behavior. #23149
+ return CMD_SIZE;
+ }
+
cmdidx_T idx;
if (!one_letter_cmd(cmd, &idx)) {