comparison src/ex_docmd.c @ 20075:516b10943fdb v8.2.0593

patch 8.2.0593: finding a user command is not optimal Commit: https://github.com/vim/vim/commit/a494f56f885876c98a276f7acfa386bfbb344680 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 18 17:45:38 2020 +0200 patch 8.2.0593: finding a user command is not optimal Problem: Finding a user command is not optimal. Solution: Start further down in the list of commands.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Apr 2020 18:00:03 +0200
parents cc146cde0b4d
children 336483164ca6
comparison
equal deleted inserted replaced
20074:0cd280c8a279 20075:516b10943fdb
3151 * Returns NULL for an ambiguous user command. 3151 * Returns NULL for an ambiguous user command.
3152 */ 3152 */
3153 char_u * 3153 char_u *
3154 find_ex_command( 3154 find_ex_command(
3155 exarg_T *eap, 3155 exarg_T *eap,
3156 int *full UNUSED, 3156 int *full UNUSED,
3157 int (*lookup)(char_u *, size_t, cctx_T *) UNUSED, 3157 int (*lookup)(char_u *, size_t, cctx_T *) UNUSED,
3158 cctx_T *cctx UNUSED) 3158 cctx_T *cctx UNUSED)
3159 { 3159 {
3160 int len; 3160 int len;
3161 char_u *p; 3161 char_u *p;
3162 int i; 3162 int i;
3163 3163
3283 // taking into account the first 2 letters of eap->cmd. 3283 // taking into account the first 2 letters of eap->cmd.
3284 eap->cmdidx = cmdidxs1[CharOrdLow(c1)]; 3284 eap->cmdidx = cmdidxs1[CharOrdLow(c1)];
3285 if (ASCII_ISLOWER(c2)) 3285 if (ASCII_ISLOWER(c2))
3286 eap->cmdidx += cmdidxs2[CharOrdLow(c1)][CharOrdLow(c2)]; 3286 eap->cmdidx += cmdidxs2[CharOrdLow(c1)][CharOrdLow(c2)];
3287 } 3287 }
3288 else if (ASCII_ISUPPER(eap->cmd[0]))
3289 eap->cmdidx = CMD_Next;
3288 else 3290 else
3289 eap->cmdidx = CMD_bang; 3291 eap->cmdidx = CMD_bang;
3290 3292
3291 for ( ; (int)eap->cmdidx < (int)CMD_SIZE; 3293 for ( ; (int)eap->cmdidx < (int)CMD_SIZE;
3292 eap->cmdidx = (cmdidx_T)((int)eap->cmdidx + 1)) 3294 eap->cmdidx = (cmdidx_T)((int)eap->cmdidx + 1))
4764 do_cmdline_cmd(eap->do_ecmd_cmd); 4766 do_cmdline_cmd(eap->do_ecmd_cmd);
4765 } 4767 }
4766 4768
4767 /* 4769 /*
4768 * Check if "c" ends an Ex command. 4770 * Check if "c" ends an Ex command.
4769 * In Vim9 script does not check for white space before #. 4771 * In Vim9 script does not check for white space before # or #{.
4770 */ 4772 */
4771 int 4773 int
4772 ends_excmd(int c) 4774 ends_excmd(int c)
4773 { 4775 {
4774 #ifdef FEAT_EVAL 4776 #ifdef FEAT_EVAL