return NULL;
}
+DEF_CMD(doc_attr_callback)
+{
+ struct call_return *cr = container_of(ci->comm, struct call_return , c);
+ cr->s = ci->str;
+ return 1;
+}
+
+char *doc_attr(struct pane *dp, struct mark *m, bool forward, char *attr)
+{
+ struct cmd_info ci = {0};
+ struct call_return cr;
+
+ ci.key = "doc:get-attr";
+ ci.home = ci.focus = dp;
+ ci.mark = m;
+ ci.numeric = forward ? 1 : 0;
+ ci.str = attr;
+ ci.comm = dp->handle;
+ cr.c = doc_attr_callback;
+ cr.s = NULL;
+ ci.comm2 = &cr.c;
+ if (!dp->handle || dp->handle->func(&ci) == 0)
+ return NULL;
+ return cr.s;
+}
+
/* the 'docs' document type is special in that there can only ever
* be one instance - the list of documents.
* So there is no 'doctype' registered, just a document which can never
struct mark *m = ci->mark;
bool forward = ci->numeric != 0;
char *attr = ci->str;
- ci->str2 = __docs_get_attr(dd->doc, m, forward, attr);
+ char *val = __docs_get_attr(dd->doc, m, forward, attr);
+
+ comm_call(ci->comm2, "callback:get_attr", ci->focus,
+ 0, NULL, val, 0);
return 1;
}
void point_notify_change(struct doc *d, struct mark *p, struct mark *m);
void doc_notify_change(struct doc *d, struct mark *m);
void doc_check_consistent(struct doc *d);
+char *doc_attr(struct pane *dp, struct mark *m, bool forward, char *attr);
void point_to_mark(struct mark *p, struct mark *m);
void mark_to_mark(struct mark *m, struct mark *target);
int mark_same(struct doc *d, struct mark *m1, struct mark *m2);
return ci.str;
}
-static inline char *doc_attr(struct pane *dp, struct mark *m, bool forward, char *attr)
-{
- struct cmd_info ci = {0};
-
- ci.key = "doc:get-attr";
- ci.home = ci.focus = dp;
- ci.mark = m;
- ci.numeric = forward ? 1 : 0;
- ci.str = attr;
- ci.comm = dp->handle;
- if (!dp->handle || dp->handle->func(&ci) == 0)
- return NULL;
- return ci.str2;
-}
-
static inline int doc_set_attr(struct pane *p, struct mark *pt,
char *attr, char *val)
{
struct call_return {
struct command c;
struct mark *m;
+ char *s;
};
static inline int call_comm(char *key, struct pane *focus, int numeric, struct mark *m,
struct mark *m = ci->mark;
bool forward = ci->numeric != 0;
char *attr = ci->str;
+ char *val = __dir_get_attr(dd->doc, m, forward, attr);
- ci->str2 = __dir_get_attr(dd->doc, m, forward, attr);
+ comm_call(ci->comm2, "callback:get_attr", ci->focus,
+ 0, NULL, val, 0);
return 1;
}
struct mark *m = ci->mark;
bool forward = ci->numeric != 0;
char *attr = ci->str;
+ char *val = __text_get_attr(dd->doc, m, forward, attr);
- ci->str2 = __text_get_attr(dd->doc, m, forward, attr);
+ comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, NULL, val, 0);
return 1;
}