about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-15 13:22:54 +0000
committerJames Booth <boothj5@gmail.com>2015-01-15 13:22:54 +0000
commit5be47cc5a9dc67b5aa206ed9c5a3bc743ab7af06 (patch)
treec1c585e56dc3f3bcf7b7e02905e38174feac3a2b /src/ui
parent40f91de7a3090f40657fb4be9ba8ca1c41257480 (diff)
downloadprofani-tty-5be47cc5a9dc67b5aa206ed9c5a3bc743ab7af06.tar.gz
Moved input size variable to ui module
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c9
-rw-r--r--src/ui/ui.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 50fa8539..8b89b12e 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -73,6 +73,7 @@
 #include "xmpp/xmpp.h"
 
 static char *win_title;
+static int inp_size;
 
 #ifdef HAVE_LIBXSS
 static Display *display;
@@ -108,6 +109,7 @@ ui_init(void)
     display = XOpenDisplay(0);
 #endif
     ui_idle_time = g_timer_new();
+    inp_size = 0;
     ProfWin *window = wins_get_current();
     win_update_virtual(window);
 }
@@ -175,10 +177,10 @@ ui_close(void)
 }
 
 gboolean
-ui_get_char(char *input, int *size)
+ui_get_char(char *input)
 {
     int result = 0;
-    wint_t ch = inp_get_char(input, size, &result);
+    wint_t ch = inp_get_char(input, &inp_size, &result);
     _win_handle_switch(ch);
     ProfWin *current = wins_get_current();
     win_handle_page(current, ch, result);
@@ -194,7 +196,8 @@ ui_get_char(char *input, int *size)
     }
 
     if (ch == '\n') {
-        input[*size++] = '\0';
+        input[inp_size++] = '\0';
+        inp_size = 0;
     }
 
     return (ch != '\n');
diff --git a/src/ui/ui.h b/src/ui/ui.h
index a482826b..8141ed2a 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -229,7 +229,7 @@ void ui_update_presence(const resource_presence_t resource_presence,
 void ui_about(void);
 void ui_statusbar_new(const int win);
 
-gboolean ui_get_char(char *input, int *size);
+gboolean ui_get_char(char *input);
 void ui_input_clear(void);
 void ui_input_nonblocking(gboolean);
 void ui_replace_input(char *input, const char * const new_input, int *size);