Mercurial > vim
comparison src/ex_docmd.c @ 24124:f4061617c438 v8.2.2603
patch 8.2.2603: Vim9: no effect if user command is also a function
Commit: https://github.com/vim/vim/commit/77b10ffad4ebad15022614be4db2745f6a90f405
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 14 13:21:35 2021 +0100
patch 8.2.2603: Vim9: no effect if user command is also a function
Problem: Vim9: no effect if user command is also a function.
Solution: Check for paren following. (closes https://github.com/vim/vim/issues/7960)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Mar 2021 13:30:03 +0100 |
parents | 291c57cf4731 |
children | 99bfaa4693db |
comparison
equal
deleted
inserted
replaced
24123:d97cddd9f357 | 24124:f4061617c438 |
---|---|
3309 */ | 3309 */ |
3310 char_u * | 3310 char_u * |
3311 find_ex_command( | 3311 find_ex_command( |
3312 exarg_T *eap, | 3312 exarg_T *eap, |
3313 int *full UNUSED, | 3313 int *full UNUSED, |
3314 int (*lookup)(char_u *, size_t, cctx_T *) UNUSED, | 3314 int (*lookup)(char_u *, size_t, int cmd, cctx_T *) UNUSED, |
3315 cctx_T *cctx UNUSED) | 3315 cctx_T *cctx UNUSED) |
3316 { | 3316 { |
3317 int len; | 3317 int len; |
3318 char_u *p; | 3318 char_u *p; |
3319 int i; | 3319 int i; |
3428 { | 3428 { |
3429 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') | 3429 if (((p - eap->cmd) > 2 && eap->cmd[1] == ':') |
3430 || *eap->cmd == '&' | 3430 || *eap->cmd == '&' |
3431 || *eap->cmd == '$' | 3431 || *eap->cmd == '$' |
3432 || *eap->cmd == '@' | 3432 || *eap->cmd == '@' |
3433 || lookup(eap->cmd, p - eap->cmd, cctx) == OK) | 3433 || lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK) |
3434 { | 3434 { |
3435 eap->cmdidx = CMD_var; | 3435 eap->cmdidx = CMD_var; |
3436 return eap->cmd; | 3436 return eap->cmd; |
3437 } | 3437 } |
3438 } | 3438 } |
3447 } | 3447 } |
3448 | 3448 |
3449 // If it is an ID it might be a variable with an operator on the next | 3449 // If it is an ID it might be a variable with an operator on the next |
3450 // line, if the variable exists it can't be an Ex command. | 3450 // line, if the variable exists it can't be an Ex command. |
3451 if (p > eap->cmd && ends_excmd(*skipwhite(p)) | 3451 if (p > eap->cmd && ends_excmd(*skipwhite(p)) |
3452 && (lookup(eap->cmd, p - eap->cmd, cctx) == OK | 3452 && (lookup(eap->cmd, p - eap->cmd, TRUE, cctx) == OK |
3453 || (ASCII_ISALPHA(eap->cmd[0]) && eap->cmd[1] == ':'))) | 3453 || (ASCII_ISALPHA(eap->cmd[0]) && eap->cmd[1] == ':'))) |
3454 { | 3454 { |
3455 eap->cmdidx = CMD_eval; | 3455 eap->cmdidx = CMD_eval; |
3456 return eap->cmd; | 3456 return eap->cmd; |
3457 } | 3457 } |