diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-26 21:01:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-26 21:01:15 +0000 |
commit | 70c43d84be98ab54d3723155dcc4232dc5a5f081 (patch) | |
tree | 31f3a580fe1bbfecc50e822e718696836d9cb95c /src/vim9cmds.c | |
parent | 1080c48ec8d672d7e9fbefb5a1255c9df09a2884 (diff) | |
download | vim-git-70c43d84be98ab54d3723155dcc4232dc5a5f081.tar.gz |
patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def functionv8.2.4225
Problem: Vim9: depth argument of :lockvar not parsed in :def function.
Solution: Parse the optional depth argument. (closes #9629)
Fix that locking doesn't work for a non-materialize list.
Diffstat (limited to 'src/vim9cmds.c')
-rw-r--r-- | src/vim9cmds.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/vim9cmds.c b/src/vim9cmds.c index 27322df1c..1af2a157e 100644 --- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -178,7 +178,7 @@ compile_lock_unlock( lval_T *lvp, char_u *name_end, exarg_T *eap, - int deep UNUSED, + int deep, void *coookie) { cctx_T *cctx = coookie; @@ -223,8 +223,9 @@ compile_lock_unlock( ret = FAIL; else { - vim_snprintf((char *)buf, len, "%s %s", + vim_snprintf((char *)buf, len, "%s %d %s", eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar", + deep, p); ret = generate_EXEC_copy(cctx, isn, buf); @@ -241,7 +242,23 @@ compile_lock_unlock( char_u * compile_unletlock(char_u *arg, exarg_T *eap, cctx_T *cctx) { - ex_unletlock(eap, arg, 0, GLV_NO_AUTOLOAD | GLV_COMPILING, + int deep = 0; + char_u *p = arg; + + if (eap->cmdidx != CMD_unlet) + { + if (eap->forceit) + deep = -1; + else if (vim_isdigit(*p)) + { + deep = getdigits(&p); + p = skipwhite(p); + } + else + deep = 2; + } + + ex_unletlock(eap, p, deep, GLV_NO_AUTOLOAD | GLV_COMPILING, eap->cmdidx == CMD_unlet ? compile_unlet : compile_lock_unlock, cctx); return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd; |