]> git.mdlowis.com Git - projs/tide.git/commitdiff
Added support for delete key
authorMike Lowis <mike.lowis@gentex.com>
Tue, 4 Oct 2016 13:29:08 +0000 (09:29 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Tue, 4 Oct 2016 13:29:08 +0000 (09:29 -0400)
.gitignore
xedit.c

index 86fa257417b4ac7a98002c4874cbc67d1246c372..df5a9860fe88c6d479cddf300f95d5bac723da68 100644 (file)
@@ -32,3 +32,4 @@
 *.dSYM/
 *.d
 edit
+unittests
diff --git a/xedit.c b/xedit.c
index 77145f7ff81d27055f04e898e5885c4f4995e76d..108c42e20cdb2159b97845c52e3dc386ab837a8d 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -148,6 +148,11 @@ static void handle_key(XEvent* e) {
                 buf_del(&Buffer, --CursorPos);
             break;
 
+        case XK_Delete:
+            if (InsertMode)
+                buf_del(&Buffer, CursorPos);
+            break;
+
         default:
             if (len > 0) {
                 Rune r;
@@ -155,7 +160,6 @@ static void handle_key(XEvent* e) {
                 if (buf[0] == '\r')
                     buf[0] = '\n';
                 for(int i = 0; i < 8 && !utf8decode(&r, &len, buf[i]); i++);
-                printf("Rune: '%c'\n", (char)r);
                 if (InsertMode)
                     buf_ins(&Buffer, CursorPos++, r);
             }