Core features
-------------
-- [ ] allow doc:get-attr to get a pane attribute if there is no content attribute.
+- [X] allow doc:get-attr to get a pane attribute if there is no content attribute.
- [ ] design a way for a keystroke to interrupt a long-running function.
- [ ] extend Draw:measure protocol to allow constant-width-fonts to
cannot-scale displays can be detected and measurement optimised for.
return 1;
}
+DEF_CMD(doc_doc_get_attr)
+{
+ /* If the document doesn't provide the attribute for
+ * this location, see if there is a pane-attribute for
+ * the document.
+ */
+ char *a;
+
+ if (!ci->str)
+ return Enoarg;
+ a = pane_attr_get(ci->home, ci->str);
+ if (a)
+ comm_call(ci->comm2, "cb", ci->focus, 0, NULL, a);
+ return 1;
+}
+
DEF_CMD(doc_set_name)
{
struct doc *d = ci->home->data;
key_add(doc_default_cmd, "doc:vmark-prev", &doc_vmarkprev);
key_add(doc_default_cmd, "doc:vmark-new", &doc_vmarknew);
key_add(doc_default_cmd, "get-attr", &doc_get_attr);
+ key_add(doc_default_cmd, "doc:get-attr", &doc_doc_get_attr);
key_add(doc_default_cmd, "doc:set-name", &doc_set_name);
key_add(doc_default_cmd, "doc:destroy", &doc_do_destroy);
key_add(doc_default_cmd, "doc:drop-cache", &doc_drop_cache);
return Enoarg;
a = text_attrset(d, m, &o);
val = attr_get_str(a, attr, o);
+ if (!val && !ci->num2)
+ return Efallthrough;
comm_call(ci->comm2, "callback:get_attr", ci->focus, 0, m, val,
0, NULL, attr);
if (ci->num2 == 1) {
if not val is None:
comm2("callback", focus, val, mark, attr)
- return 1
+ return 1
+ return edlib.Efallthrough
def handle_get_attr(self, key, focus, str, comm2, **a):
"handle:get-attr"