From: NeilBrown Date: Wed, 9 Dec 2015 09:34:57 +0000 (+1100) Subject: Return value from doc:add-view directly X-Git-Tag: lca2016~97 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=ad5dbab53faaae721b55ccf3c84603b9f768a279;p=edlib.git Return value from doc:add-view directly Just like doc:find-view Signed-off-by: NeilBrown --- diff --git a/core-doc.c b/core-doc.c index 4d348edf..cead79a8 100644 --- a/core-doc.c +++ b/core-doc.c @@ -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 29290682..0dcee8d7 100644 --- 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)