From: Michael D. Lowis Date: Thu, 12 Jan 2017 04:14:40 +0000 (-0500) Subject: ctrl+d should select the command under cursor if nothing selected X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=de90650e3b00d3a879a061245bef5661a4b1dc82;p=projs%2Ftide.git ctrl+d should select the command under cursor if nothing selected --- diff --git a/inc/edit.h b/inc/edit.h index f4aa893..f5e2de8 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -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); diff --git a/lib/view.c b/lib/view.c index e5e486e..c51a1f5 100644 --- a/lib/view.c +++ b/lib/view.c @@ -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 c5fc344..a794466 100644 --- 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); }