vim-patch:8.2.0593: finding a user command is not optimal (#19386)

Problem:    Finding a user command is not optimal.
Solution:   Start further down in the list of commands.
a494f56f88
This commit is contained in:
zeertzjq 2022-07-16 13:49:48 +08:00 committed by GitHub
parent 591765c915
commit fa29bc94b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -3298,6 +3298,7 @@ module.cmds = {
addr_type='ADDR_LINES', addr_type='ADDR_LINES',
func='ex_z', func='ex_z',
}, },
-- commands that don't start with a letter
{ {
command='!', command='!',
enum='CMD_bang', enum='CMD_bang',
@ -3347,12 +3348,6 @@ module.cmds = {
addr_type='ADDR_LINES', addr_type='ADDR_LINES',
func='ex_at', func='ex_at',
}, },
{
command='Next',
flags=bit.bor(EXTRA, RANGE, COUNT, BANG, CMDARG, ARGOPT, TRLBAR),
addr_type='ADDR_OTHER',
func='ex_previous',
},
{ {
command='~', command='~',
enum='CMD_tilde', enum='CMD_tilde',
@ -3360,6 +3355,13 @@ module.cmds = {
addr_type='ADDR_LINES', addr_type='ADDR_LINES',
func='ex_substitute', func='ex_substitute',
}, },
-- commands that start with an uppercase letter
{
command='Next',
flags=bit.bor(EXTRA, RANGE, COUNT, BANG, CMDARG, ARGOPT, TRLBAR),
addr_type='ADDR_OTHER',
func='ex_previous',
},
} }
return module return module

View File

@ -3028,6 +3028,8 @@ char *find_ex_command(exarg_T *eap, int *full)
if (ASCII_ISLOWER(c2)) { if (ASCII_ISLOWER(c2)) {
eap->cmdidx += cmdidxs2[CHAR_ORD_LOW(c1)][CHAR_ORD_LOW(c2)]; eap->cmdidx += cmdidxs2[CHAR_ORD_LOW(c1)][CHAR_ORD_LOW(c2)];
} }
} else if (ASCII_ISUPPER(eap->cmd[0])) {
eap->cmdidx = CMD_Next;
} else { } else {
eap->cmdidx = CMD_bang; eap->cmdidx = CMD_bang;
} }