]> git.neil.brown.name Git - edlib.git/commitdiff
Change doc:find-view to return value directly.
authorNeilBrown <neil@brown.name>
Tue, 8 Dec 2015 00:10:18 +0000 (11:10 +1100)
committerNeilBrown <neil@brown.name>
Wed, 9 Dec 2015 23:00:50 +0000 (10:00 +1100)
I'm moving away from using the cmd_info to return stuff.
So for numbers, just return them directly.

Signed-off-by: NeilBrown <neil@brown.name>
core-doc.c
core.h

index 83d9f9a52ba55ec70d173d83ef0ab97d20b1b0b7..29d5870a0df1370562ed247af9ff503520cacc53 100644 (file)
@@ -418,10 +418,13 @@ DEF_CMD(doc_handle)
        }
 
        if (strcmp(ci->key, "doc:find-view") == 0) {
+               int ret;
                if (!ci->comm2)
                        return -1;
-               ci->extra = do_doc_find_view(dd->doc, ci->comm2);
-               return 1;
+               ret =  do_doc_find_view(dd->doc, ci->comm2);
+               if (ret < 0)
+                       return ret;
+               return ret + 1;
        }
 
        if (strcmp(ci->key, "doc:find") == 0) {
diff --git a/core.h b/core.h
index 1fe45535797fb5892051be58c427101b7628fbdb..53f0a1dcb93718a20b6b14ec3e4b77dbfb38ecb3 100644 (file)
--- a/core.h
+++ b/core.h
@@ -449,12 +449,15 @@ static inline void doc_del_view(struct pane *p, struct command *c)
 static inline int doc_find_view(struct pane *p, struct command *c)
 {
        struct cmd_info ci = {0};
+       int ret;
+
        ci.focus = p;
        ci.key = "doc:find-view";
        ci.comm2 = c;
-       if (key_handle_focus(&ci) == 0)
+       ret = key_handle_focus(&ci);
+       if (ret <= 0)
                return -1;
-       return ci.extra;
+       return ret - 1;
 }
 
 static inline struct doc *doc_from_pane(struct pane *p)