about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-04-09 23:40:26 +0100
committerJames Booth <boothj5@gmail.com>2012-04-09 23:40:26 +0100
commit9450c8f2fabcdff7f1c8086970b7dc191580db1f (patch)
tree43da0139d08aa0d0c4945b31babd3b21481a549a
parent525c04d7aefe01283b2a89c03ae7c9a521a7e78e (diff)
downloadprofani-tty-9450c8f2fabcdff7f1c8086970b7dc191580db1f.tar.gz
Implemented DEL key on input
-rw-r--r--input_win.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/input_win.c b/input_win.c
index 10fd2f40..96576070 100644
--- a/input_win.c
+++ b/input_win.c
@@ -176,6 +176,19 @@ static int _handle_edit(const int ch, char *input, int *size)
         }
         return 1;
 
+    case KEY_DC: // DEL
+        if (inp_x <= *size) {
+            wdelch(inp_win);
+    
+            // if not last char, shift chars left
+            if (inp_x < *size)
+                for (i = inp_x-1; i < *size; i++)
+                    input[i] = input[i+1];
+            
+            (*size)--;
+        }
+        return 1;
+
     case KEY_LEFT:
         if (inp_x > 1)
             wmove(inp_win, inp_y, inp_x-1);