]> git.mdlowis.com Git - projs/tide.git/commitdiff
ctrl+d should select the command under cursor if nothing selected
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 12 Jan 2017 04:14:40 +0000 (23:14 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 12 Jan 2017 04:14:40 +0000 (23:14 -0500)
inc/edit.h
lib/view.c
xedit.c

index f4aa893d3dda79f365bacc07a93bb9b9ec924c0d..f5e2de8b49e12b2c59a73449f218c7b459859996 100644 (file)
@@ -165,6 +165,7 @@ void view_redo(View* view);
 void view_putstr(View* view, char* str);
 void view_append(View* view, char* str);
 char* view_getstr(View* view, Sel* sel);
+char* view_getcmd(View* view);
 char* view_getctx(View* view);
 void view_scroll(View* view, int move);
 void view_scrollpage(View* view, int move);
index e5e486ee4e15769ece33724450ce0f22172a08a8..c51a1f5984c6edf00621a639e4b5976f3a12cb3e 100644 (file)
@@ -541,6 +541,13 @@ char* view_getstr(View* view, Sel* range) {
     return str;
 }
 
+char* view_getcmd(View* view) {
+    Sel sel = view->selection;
+    buf_getword(&(view->buffer), riscmd, &sel);
+    sel.end++;
+    return view_getstr(view, &sel);
+}
+
 char* view_getctx(View* view) {
     if (0 == num_selected(view->selection)) {
         selcontext(view, &(view->selection));
diff --git a/xedit.c b/xedit.c
index c5fc34420a05eafbb11c6a171719535367bc9783..a7944664ded44ec471d0274a80402c470c427a1d 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -552,7 +552,7 @@ static void search(void) {
 }
 
 static void execute(void) {
-    char* str = view_getstr(currview(), NULL);
+    char* str = view_getcmd(currview());
     if (str) exec(str);
     free(str);
 }