diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-16 22:56:03 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-16 22:56:03 +0200 |
commit | 0e57dd859ecb1e8a3b91509d2f4343e839340eb8 (patch) | |
tree | 50e5f097f3fe10851e7af017cea6cdef35b12402 /src/userfunc.c | |
parent | 69198cb8c08f124729c41a4681f2d142228a9139 (diff) | |
download | vim-git-0e57dd859ecb1e8a3b91509d2f4343e839340eb8.tar.gz |
patch 8.1.2047: cannot check the current statev8.1.2047
Problem: Cannot check the current state.
Solution: Add the state() function.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 3f9171d2e..a6ac29ece 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1447,6 +1447,14 @@ func_call( return r; } +static int callback_depth = 0; + + int +get_callback_depth(void) +{ + return callback_depth; +} + /* * Invoke call_func() with a callback. */ @@ -1460,12 +1468,15 @@ call_callback( // PLUS ONE elements! { funcexe_T funcexe; + int ret; vim_memset(&funcexe, 0, sizeof(funcexe)); funcexe.evaluate = TRUE; funcexe.partial = callback->cb_partial; - return call_func(callback->cb_name, len, rettv, argcount, argvars, - &funcexe); + ++callback_depth; + ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe); + --callback_depth; + return ret; } /* |