about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-09-04 23:14:35 +0100
committerJames Booth <boothj5@gmail.com>2013-09-04 23:14:35 +0100
commitff8bb1bbbe79d28b953f8139dd0183653b1e5964 (patch)
treedf3ca9a9df6676360ebc8b9dd0adbe2ba5fadb6f /src
parentcbdb426343556a2c3a6704b6627a12885f8a87b6 (diff)
downloadprofani-tty-ff8bb1bbbe79d28b953f8139dd0183653b1e5964.tar.gz
Proper fix for #235
Diffstat (limited to 'src')
-rw-r--r--src/ui/inputwin.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index de91e826..7250afc8 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -250,9 +250,6 @@ _clear_input(void)
 static int
 _handle_edit(int result, const wint_t ch, char *input, int *size)
 {
-    if (result != KEY_CODE_YES) {
-        return 0;
-    }
     char *prev = NULL;
     char *next = NULL;
     int inp_x = 0;
@@ -375,6 +372,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
 
         case 127:
         case KEY_BACKSPACE:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             roster_reset_search_attempts();
             if (display_size > 0) {
 
@@ -426,6 +426,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_DC: // DEL
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             if (inp_x == display_size-1) {
                 gchar *start = g_utf8_substring(input, 0, inp_x);
                 for (*size = 0; *size < strlen(start); (*size)++) {
@@ -459,6 +462,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_LEFT:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             if (inp_x > 0) {
                 wmove(inp_win, 0, inp_x-1);
 
@@ -471,6 +477,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_RIGHT:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             if (inp_x < display_size) {
                 wmove(inp_win, 0, inp_x+1);
 
@@ -483,6 +492,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_UP:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             prev = cmd_history_previous(input, size);
             if (prev) {
                 inp_replace_input(input, prev, size);
@@ -490,6 +502,9 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_DOWN:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             next = cmd_history_next(input, size);
             if (next) {
                 inp_replace_input(input, next, size);
@@ -501,12 +516,18 @@ _handle_edit(int result, const wint_t ch, char *input, int *size)
             return 1;
 
         case KEY_HOME:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             wmove(inp_win, 0, 0);
             pad_start = 0;
             _inp_win_refresh();
             return 1;
 
         case KEY_END:
+            if (result != KEY_CODE_YES) {
+                return 0;
+            }
             _go_to_end(display_size);
             return 1;