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>
}
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) {
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)