]> git.mdlowis.com Git - projs/tide.git/commitdiff
removed selection arg from view api
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 4 Apr 2018 17:17:10 +0000 (13:17 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 4 Apr 2018 17:17:10 +0000 (13:17 -0400)
inc/edit.h
lib/view.c
tide.c

index ea0a08812b892285178bee6af9edfb7c3d26ebbc..f24bbc981977b38f86bb26ce67c752f9a4640c3e 100644 (file)
@@ -132,7 +132,7 @@ void view_eof(View* view, bool extsel);
 void view_undo(View* view);
 void view_redo(View* view);
 void view_putstr(View* view, char* str);
-char* view_getstr(View* view, Sel* sel);
+char* view_getstr(View* view);
 char* view_getcmd(View* view);
 char* view_getword(View* view);
 char* view_getctx(View* view);
index 31f36bfc7d9f8eeb63dcb709cd78144e755388ae..12bfef38dbc83867c512e3167a61f71fd990f342 100644 (file)
@@ -139,12 +139,13 @@ char* view_fetch(View* view, size_t row, size_t col, bool (*isword)(Rune)) {
    char* str = NULL;
     size_t off = getoffset(view, row, col);
     if (off != SIZE_MAX) {
-        Sel sel = { .beg = off, .end = off };
-        if (buf_insel(&(view->buffer), NULL, off))
-            sel = *(getsel(view));
-        else
-            buf_selword(&(view->buffer), isword, &sel);
-        str = view_getstr(view, &sel);
+        /* str = buf_fetchat(buf, isword, off) */
+//        Sel sel = { .beg = off, .end = off };
+//        if (buf_insel(&(view->buffer), NULL, off))
+//            sel = *(getsel(view));
+//        else
+//            buf_selword(&(view->buffer), isword, &sel);
+//        str = view_getstr(view, &sel);
     }
     return str;
 }
@@ -220,14 +221,14 @@ void view_putstr(View* view, char* str) {
     buf_puts(&(view->buffer), str, NULL);
 }
 
-char* view_getstr(View* view, Sel* range) {
-    return buf_gets(&(view->buffer), (range ? range : getsel(view)));
+char* view_getstr(View* view) {
+    return buf_gets(&(view->buffer), NULL);
 }
 
 char* view_getcmd(View* view) {
     if (!view_selsize(view))
         buf_selctx(&(view->buffer), riscmd, NULL);
-    return view_getstr(view, NULL);
+    return view_getstr(view);
 }
 
 void view_selctx(View* view) {
@@ -237,7 +238,7 @@ void view_selctx(View* view) {
 
 char* view_getctx(View* view) {
     view_selctx(view);
-    return view_getstr(view, NULL);
+    return view_getstr(view);
 }
 
 void view_scroll(View* view, int move) {
diff --git a/tide.c b/tide.c
index 4ef24339394c7bcc1abaff491aa24fe842df0bc0..539ad07bcfb5ca129668d5879eca091190abbecb 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -69,7 +69,7 @@ void cut(char* arg) {
     if (!view_selsize(view))
         select_line(arg);
     /* now perform the cut */
-    char* str = view_getstr(view, NULL);
+    char* str = view_getstr(view);
     x11_sel_set(CLIPBOARD, str);
     if (str && *str) delete(arg);
 }
@@ -82,7 +82,7 @@ static void copy(char* arg) {
     /* select the current line if no selection */
     if (!view_selsize(win_view(FOCUSED)))
         select_line(arg);
-    char* str = view_getstr(win_view(FOCUSED), NULL);
+    char* str = view_getstr(win_view(FOCUSED));
     x11_sel_set(CLIPBOARD, str);
 }
 
@@ -218,8 +218,8 @@ static Tag* tag_lookup(char* cmd) {
 
 static void tag_exec(Tag* tag, char* arg) {
     /* if we didnt get an arg, find one in the selection */
-    if (!arg) arg = view_getstr(win_view(TAGS), NULL);
-    if (!arg) arg = view_getstr(win_view(EDIT), NULL);
+    if (!arg) arg = view_getstr(win_view(TAGS));
+    if (!arg) arg = view_getstr(win_view(EDIT));
     /* execute the tag handler */
     tag->action(arg);
     free(arg);
@@ -236,7 +236,7 @@ static void cmd_exec(char* cmd) {
     /* get the selection that the command will operate on */
     if (op && op != '<' && op != '!' && 0 == view_selsize(win_view(EDIT)))
         view_selectall(win_view(EDIT));
-    char* input = view_getstr(win_view(EDIT), NULL);
+    char* input = view_getstr(win_view(EDIT));
     size_t len  = (input ? strlen(input) : 0);
     View *tags = win_view(TAGS), *edit = win_view(EDIT), *curr = win_view(FOCUSED);
 
@@ -340,7 +340,7 @@ static void pick_ctag(char* arg) {
 static void complete(char* arg) {
     View* view = win_view(FOCUSED);
     view_selectobj(view, risword);
-    cmd_execwitharg(CMD_COMPLETE, view_getstr(view, NULL));
+    cmd_execwitharg(CMD_COMPLETE, view_getstr(view));
 }
 
 static void jump_to(char* arg) {