aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rspamadm/lua_repl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c
index 36de84c23..c7f873df2 100644
--- a/src/rspamadm/lua_repl.c
+++ b/src/rspamadm/lua_repl.c
@@ -394,6 +394,7 @@ rspamadm_lua_run_repl (lua_State *L)
gchar *input;
gboolean is_multiline = FALSE;
GString *tb;
+ guint i;
for (;;) {
if (!is_multiline) {
@@ -435,11 +436,20 @@ rspamadm_lua_run_repl (lua_State *L)
is_multiline = FALSE;
linenoiseFree (input);
rspamadm_exec_input (L, tb->str);
+
+ /* Replace \n with ' ' for sanity */
+ for (i = 0; i < tb->len; i ++) {
+ if (tb->str[i] == '\n') {
+ tb->str[i] = ' ';
+ }
+ }
+
+ linenoiseHistoryAdd (tb->str);
g_string_free (tb, TRUE);
}
else {
g_string_append (tb, input);
- g_string_append (tb, "\n");
+ g_string_append (tb, " \n");
linenoiseFree (input);
}
}