Mercurial > vim
comparison src/usercmd.c @ 25210:8d816c266ceb v8.2.3141
patch 8.2.3141: no error when using :complete for :command without -nargs
Commit: https://github.com/vim/vim/commit/de69a7353e9bec552e15dbe3706a9f4e88080fce
Author: Martin Tournoij <martin@arp242.net>
Date: Sun Jul 11 14:28:25 2021 +0200
patch 8.2.3141: no error when using :complete for :command without -nargs
Problem: No error when using :complete for :command without -nargs.
Solution: Give an error. (Martin Tournoij, closes https://github.com/vim/vim/issues/8544, closes https://github.com/vim/vim/issues/8541)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Jul 2021 14:30:04 +0200 |
parents | 7334bf933510 |
children | a9ea83a3659a |
comparison
equal
deleted
inserted
replaced
25209:dda30b95f9bc | 25210:8d816c266ceb |
---|---|
1017 | 1017 |
1018 // If there is nothing after the name, and no attributes were specified, | 1018 // If there is nothing after the name, and no attributes were specified, |
1019 // we are listing commands | 1019 // we are listing commands |
1020 p = skipwhite(end); | 1020 p = skipwhite(end); |
1021 if (!has_attr && ends_excmd2(eap->arg, p)) | 1021 if (!has_attr && ends_excmd2(eap->arg, p)) |
1022 { | |
1023 uc_list(name, end - name); | 1022 uc_list(name, end - name); |
1024 } | |
1025 else if (!ASCII_ISUPPER(*name)) | 1023 else if (!ASCII_ISUPPER(*name)) |
1026 { | |
1027 emsg(_("E183: User defined commands must start with an uppercase letter")); | 1024 emsg(_("E183: User defined commands must start with an uppercase letter")); |
1028 return; | |
1029 } | |
1030 else if ((name_len == 1 && *name == 'X') | 1025 else if ((name_len == 1 && *name == 'X') |
1031 || (name_len <= 4 | 1026 || (name_len <= 4 |
1032 && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) | 1027 && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) |
1033 { | |
1034 emsg(_("E841: Reserved name, cannot be used for user defined command")); | 1028 emsg(_("E841: Reserved name, cannot be used for user defined command")); |
1035 return; | 1029 else if (compl > 0 && (argt & EX_EXTRA) == 0) |
1036 } | 1030 emsg(_(e_complete_used_without_nargs)); |
1037 else | 1031 else |
1038 uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, | 1032 uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, |
1039 addr_type_arg, eap->forceit); | 1033 addr_type_arg, eap->forceit); |
1040 } | 1034 } |
1041 | 1035 |