diff --git a/src/lua/console.c b/src/lua/console.c index a8bd133ccd66a517eca429927d20e47ff42353a4..2d2e5ff7dce0cc140fc475ea0b01e01deca2b7cf 100644 --- a/src/lua/console.c +++ b/src/lua/console.c @@ -99,7 +99,8 @@ console_completion_handler(const char *text, int start, int end) */ if (lua_equal(readline_L, -1, lua_upvalueindex(1))) { lua_pop(readline_L, 1); - return lua_rl_complete(readline_L, text, start, end); + res = lua_rl_complete(readline_L, text, start, end); + goto done; } /* Slow path - arbitrary completion handler. */ @@ -126,6 +127,10 @@ console_completion_handler(const char *text, int start, int end) lua_pop(readline_L, 1); } lua_pop(readline_L, 1); +done: +#if RL_READLINE_VERSION >= 0x0600 + rl_completion_suppress_append = 1; +#endif return res; } @@ -609,8 +614,5 @@ lua_rl_complete(lua_State *L, const char *text, int start, int end) } lua_settop(L, savetop); -#if RL_READLINE_VERSION >= 0x0600 - rl_completion_suppress_append = 1; -#endif return ml.list; }