diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 11:22:25 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 14:16:16 +0800 |
commit | 64ccfdaafef56b451e3a5eed94367fad93978ec8 (patch) | |
tree | 47a238c11a2a234da43fb07cb5db6581b6a4ebcb /src/nvim/eval.c | |
parent | 4956f267449ca7526145c63ef095bfd731174635 (diff) | |
download | rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.tar.gz rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.tar.bz2 rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.zip |
vim-patch:8.1.2047: cannot check the current state
Problem: Cannot check the current state.
Solution: Add the state() function.
https://github.com/vim/vim/commit/0e57dd859ecb1e8a3b91509d2f4343e839340eb8
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 08c5ef743b..052d67b05f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5994,6 +5994,13 @@ bool callback_from_typval(Callback *const callback, const typval_T *const arg) return true; } +static int callback_depth = 0; + +int get_callback_depth(void) +{ + return callback_depth; +} + /// @return whether the callback could be called. bool callback_call(Callback *const callback, const int argcount_in, typval_T *const argvars_in, typval_T *const rettv) @@ -6041,7 +6048,11 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co funcexe.fe_lastline = curwin->w_cursor.lnum; funcexe.fe_evaluate = true; funcexe.fe_partial = partial; - return call_func(name, -1, rettv, argcount_in, argvars_in, &funcexe); + + callback_depth++; + int ret = call_func(name, -1, rettv, argcount_in, argvars_in, &funcexe); + callback_depth--; + return ret; } bool set_ref_in_callback(Callback *callback, int copyID, ht_stack_T **ht_stack, |