diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-08 01:54:58 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-08 01:54:58 +0300 |
commit | 043d8ff9f2389f8deab7934aa0ab4ce88a747f01 (patch) | |
tree | 4d6fa32d7c1ddaa99c15f80c1a4ba95d5f3ca2da /src/nvim/viml/executor/executor.c | |
parent | 5992cdf3c27ee9c73cea22e288c6ea6d54867394 (diff) | |
parent | 13352c00f1909d9296c5f276a3735f5e6f231b39 (diff) | |
download | rneovim-043d8ff9f2389f8deab7934aa0ab4ce88a747f01.tar.gz rneovim-043d8ff9f2389f8deab7934aa0ab4ce88a747f01.tar.bz2 rneovim-043d8ff9f2389f8deab7934aa0ab4ce88a747f01.zip |
Merge branch 'master' into luaviml'/lua
Diffstat (limited to 'src/nvim/viml/executor/executor.c')
-rw-r--r-- | src/nvim/viml/executor/executor.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/nvim/viml/executor/executor.c b/src/nvim/viml/executor/executor.c index d0e269bf6a..826460772e 100644 --- a/src/nvim/viml/executor/executor.c +++ b/src/nvim/viml/executor/executor.c @@ -461,18 +461,33 @@ nlua_print_error: int nlua_debug(lua_State *lstate) FUNC_ATTR_NONNULL_ALL { + const typval_T input_args[] = { + { + .v_lock = VAR_FIXED, + .v_type = VAR_STRING, + .vval.v_string = (char_u *)"lua_debug> ", + }, + { + .v_type = VAR_UNKNOWN, + }, + }; for (;;) { lua_settop(lstate, 0); - char *const input = get_user_input("lua_debug> ", "", NULL, NULL); + typval_T input; + get_user_input(input_args, &input, false); msg_putchar('\n'); // Avoid outputting on input line. - if (input == NULL || *input == NUL || strcmp(input, "cont") == 0) { - xfree(input); + if (input.v_type != VAR_STRING + || input.vval.v_string == NULL + || *input.vval.v_string == NUL + || STRCMP(input.vval.v_string, "cont") == 0) { + tv_clear(&input); return 0; } - if (luaL_loadbuffer(lstate, input, strlen(input), "=(debug command)")) { + if (luaL_loadbuffer(lstate, (const char *)input.vval.v_string, + STRLEN(input.vval.v_string), "=(debug command)")) { nlua_error(lstate, _("E5115: Error while loading debug string: %.*s")); } - xfree(input); + tv_clear(&input); if (lua_pcall(lstate, 0, 0, 0)) { nlua_error(lstate, _("E5116: Error while calling debug string: %.*s")); } @@ -517,7 +532,7 @@ void ex_lua(exarg_T *const eap) } typval_T tv = { .v_type = VAR_UNKNOWN }; executor_exec_lua((String) { .data = code, .size = len }, &tv); - clear_tv(&tv); + tv_clear(&tv); xfree(code); } |