]> git.mdlowis.com Git - projs/tide.git/commitdiff
Ctrl+X now cuts the current line if there is no current selection
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 17 May 2017 19:30:28 +0000 (15:30 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 17 May 2017 19:30:28 +0000 (15:30 -0400)
xedit.c

diff --git a/xedit.c b/xedit.c
index 82e31957511044a85c0e6ea94103ffc5f8900e20..25701fd63f609f2a006720942b6808c5840a8c7c 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -115,7 +115,14 @@ static void onpaste(char* text) {
 }
 
 static void cut(void) {
-    char* str = view_getstr(win_view(FOCUSED), NULL);
+    View* view = win_view(FOCUSED);
+    /* select the current line if no selection */
+    if (!view_selsize(view)) {
+        view_eol(view, false);
+        view_selctx(view);
+    }
+    /* now perform the cut */
+    char* str = view_getstr(view, NULL);
     x11_sel_set(CLIPBOARD, str);
     if (str && *str) delete();
 }