]> git.neil.brown.name Git - edlib.git/commitdiff
Return value from doc:add-view directly
authorNeilBrown <neil@brown.name>
Wed, 9 Dec 2015 09:34:57 +0000 (20:34 +1100)
committerNeilBrown <neil@brown.name>
Thu, 10 Dec 2015 02:54:09 +0000 (13:54 +1100)
Just like doc:find-view

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

index 4d348edf268e63f3a42127ce96c02f7c41c03355..cead79a8781ae71a1b9f8bd3847453c3271cb0a2 100644 (file)
@@ -411,8 +411,7 @@ DEF_CMD(doc_handle)
        if (strcmp(ci->key, "doc:add-view") == 0) {
                if (!ci->comm2)
                        return -1;
-               ci->extra = do_doc_add_view(dd->doc, ci->comm2, ci->extra);
-               return 1;
+               return 1 + do_doc_add_view(dd->doc, ci->comm2, ci->extra);
        }
 
        if (strcmp(ci->key, "doc:del-view") == 0) {
diff --git a/core.h b/core.h
index 2929068293d2f9feb6ba3c5d39952d4a83600669..0dcee8d76cbdea3ca33b454d46772c88f2965a6d 100644 (file)
--- a/core.h
+++ b/core.h
@@ -405,13 +405,15 @@ static inline int doc_set_attr(struct pane *p, struct mark *pt,
 static inline int doc_add_view(struct pane *p, struct command *c, int size)
 {
        struct cmd_info ci = {0};
+       int ret;
        ci.focus = p;
        ci.key = "doc:add-view";
        ci.comm2 = c;
        ci.extra = size;
-       if (key_handle_focus(&ci) == 0)
+       ret = key_handle_focus(&ci);
+       if (ret <= 0)
                return -1;
-       return ci.extra;
+       return ret - 1;
 }
 
 static inline void doc_del_view(struct pane *p, struct command *c)