From aef216b3c4d3c7fa4d878cdacabc77d04f0619cc Mon Sep 17 00:00:00 2001
From: Nick Zavaritsky <mejedi@gmail.com>
Date: Thu, 29 Sep 2016 16:36:32 +0300
Subject: [PATCH] Suppress extra whitespace in remote completion

---
 src/lua/console.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lua/console.c b/src/lua/console.c
index a8bd133ccd..2d2e5ff7dc 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;
 }
-- 
GitLab