]> git.mdlowis.com Git - projs/tide.git/commitdiff
select line shortcut now handles multiple lines
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 14 Sep 2018 00:49:51 +0000 (20:49 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 14 Sep 2018 00:49:51 +0000 (20:49 -0400)
tide.c

diff --git a/tide.c b/tide.c
index 040038c0df74d3d51611f9a27e4d2a12636c70f2..d765281ee67b82e7b6a19efa1065215728c4f958 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -102,9 +102,16 @@ void exec(char* cmd) {
 /* Keyboard and Tag Handlers
  ******************************************************************************/
 static void select_line(char* arg) {
-    View* view = win_view(FOCUSED);
-    view_eol(view, false);
-    view_selctx(view);
+    Buf* buf = win_buf(FOCUSED);
+    if (buf->selection.beg <= buf->selection.end) {
+        buf->selection.beg = buf_bol(buf, buf->selection.beg);
+        buf->selection.end = buf_eol(buf, buf->selection.end);
+        buf->selection.end = buf_byrune(buf, buf->selection.end, RIGHT);
+    } else {
+        buf->selection.beg = buf_eol(buf, buf->selection.beg);
+        buf->selection.beg = buf_byrune(buf, buf->selection.beg, RIGHT);
+        buf->selection.end = buf_bol(buf, buf->selection.end);
+    }
 }
 
 static void join_lines(char* arg) {