}
if (strcmp(ci->key, "doc:vmark-get") == 0) {
- ci->mark = do_vmark_first(dd->doc, ci->numeric);
- ci->mark2 = do_vmark_last(dd->doc, ci->numeric);
+ struct mark *m, *m2;
+ m = do_vmark_first(dd->doc, ci->numeric);
+ m2 = do_vmark_last(dd->doc, ci->numeric);
if (ci->extra && dd->point)
- ci->mark2 = do_vmark_at_point(dd->doc, dd->point,
- ci->numeric);
- return 1;
+ m2 = do_vmark_at_point(dd->doc, dd->point,
+ ci->numeric);
+ return comm_call7(ci->comm2, "callback:vmark", ci->focus,
+ 0, m, NULL, 0, NULL, m2);
}
ret = key_lookup(dd->doc->map, ci);
return NULL;
}
+DEF_CMD(take_marks)
+{
+ struct call_return *cr = container_of(ci->comm, struct call_return, c);
+ cr->m = ci->mark;
+ cr->m2 = ci->mark2;
+ return 1;
+}
+
static int vmark_get(struct pane *p, int view,
struct mark **first, struct mark **last, struct mark **point)
{
struct cmd_info ci = {0};
+ struct call_return cr;
ci.key = "doc:vmark-get";
ci.focus = p;
ci.numeric = view;
+ cr.c = take_marks;
+ cr.m = cr.m2 = NULL;
+ ci.comm2 = &cr.c;
if (point)
ci.extra = 1;
if (key_handle_focus(&ci) == 0)
return 0;
if (first)
- *first = ci.mark;
+ *first = cr.m;
if (point)
- *point = ci.mark2;
+ *point = cr.m2;
else if (last)
- *last = ci.mark2;
+ *last = cr.m2;
return 1;
}
struct call_return {
struct command c;
- struct mark *m;
+ struct mark *m, *m2;
char *s;
struct pane *p;
int i;
return comm->func(&ci);
}
+static inline int comm_call7(struct command *comm, char *key,
+ struct pane *focus,
+ int numeric, struct mark *m, char *str,
+ int extra, char *str2, struct mark *m2)
+{
+ struct cmd_info ci = {0};
+
+ if (!comm)
+ return -1;
+ ci.key = key;
+ ci.focus = focus;
+ ci.numeric = numeric;
+ ci.mark = m;
+ ci.mark2 = m2;
+ ci.str = str;
+ ci.str2 = str2;
+ ci.extra = extra;
+ ci.comm = comm;
+ return comm->func(&ci);
+}
+
static inline int call_extra(char *key, struct pane *focus, int numeric, struct mark *m,
int extra)
{