]> git.neil.brown.name Git - edlib.git/commitdiff
emacs: use pane_final_child rather than pane_point.
authorNeilBrown <neil@brown.name>
Wed, 25 Nov 2015 09:46:37 +0000 (20:46 +1100)
committerNeilBrown <neil@brown.name>
Wed, 25 Nov 2015 09:46:37 +0000 (20:46 +1100)
This is (now) a suitable place to attach attributes.

Signed-off-by: NeilBrown <neil@brown.name>
core-pane.c
mode-emacs.c

index 469c6856b30401a98ee1ed4017c3bb20cee96bb8..61c6efb3797b765978289057738a17983b73cfe3 100644 (file)
@@ -507,6 +507,9 @@ void pane_text(struct pane *p, wchar_t ch, char *attrs, int x, int y)
 
 char *pane_attr_get(struct pane *p, char *key)
 {
+       struct pane *c;
+       while ((c = pane_child(p)) != NULL)
+               p = c;
        while (p) {
                char *a = attr_get_str(p->attrs, key, -1);
                if (a)
index b55bd8fb0a9862b23e192380fd8a39024f2bd8e9..2da6abbedb62d30394f3d8290e8c44b17f64755e 100644 (file)
@@ -346,7 +346,6 @@ DEF_CMD(emacs_file_complete)
        int fd;
        struct pane *par, *pop, *docp;
        struct cmd_info ci2 = {0};
-       struct point **ptp;
 
        d = str;
        while ((c = strstr(d, "//")) != NULL)
@@ -368,9 +367,7 @@ DEF_CMD(emacs_file_complete)
        docp = doc_open(doc->ed, fd, d);
        close(fd);
        pop = pane_attach(ci->focus, "popup", docp, "DM1");
-       ptp = pane_point(pane_final_child(pop));
-       /* Want to work with the document pane */
-       par = container_of(ptp, struct pane, point);
+       par = pane_final_child(pop);
 
        attr_set_str(&par->attrs, "line-format", "%+name%suffix", -1);
        attr_set_str(&par->attrs, "heading", "", -1);
@@ -468,12 +465,9 @@ DEF_CMD(emacs_doc_complete)
        char *str = doc_getstr(ci->focus, NULL);
        struct pane *par, *pop;
        struct cmd_info ci2 = {0};
-       struct point **ptp;
 
        pop = pane_attach(ci->focus, "popup", doc->ed->docs->home, "DM1");
-       ptp = pane_point(pane_final_child(pop));
-       /* Want to work with the document pane */
-       par = container_of(ptp, struct pane, point);
+       par = pane_final_child(pop);
 
        attr_set_str(&par->attrs, "line-format", "%+name", -1);
        attr_set_str(&par->attrs, "heading", "", -1);