From 3815d708662e2a3c288b70009b2799bbce4fc964 Mon Sep 17 00:00:00 2001 From: Bradley Smith Date: Sat, 8 Mar 2008 23:17:19 +0000 Subject: Add readline support to text plugin. Signed-off-by: Bradley Smith --- lib/textplugin.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'lib/textplugin.c') diff --git a/lib/textplugin.c b/lib/textplugin.c index 61110d5..0c3059c 100644 --- a/lib/textplugin.c +++ b/lib/textplugin.c @@ -23,13 +23,17 @@ #include #include #include +#include #include "configs.h" #include "textplugin.h" +#include +#include + enum { ARG_0, - ARG_MAP + ARG_MAP }; GType _text_plugin_type = 0; @@ -350,8 +354,20 @@ inline void text_plugin_get_string (TextPlugin *text, gchar *buff, gint len) { - fputs (prompt, stdout); - fgets (buff, len, stdin); + char* line = (char*)NULL; + + line = readline(prompt); + + if(line && *line) + { + add_history(line); + + g_strlcpy(buff, line, len); + } + else + buff = ""; + + free(line); } inline void text_plugin_update_status (TextPlugin *text, -- cgit v1.1