patch 8.1.2047: cannot check the current state
Problem: Cannot check the current state.
Solution: Add the state() function.
diff --git a/src/userfunc.c b/src/userfunc.c
index 3f9171d..a6ac29e 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1447,6 +1447,14 @@
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 @@
// 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;
}
/*