]> git.neil.brown.name Git - edlib.git/commitdiff
pane_attach: always return the top-level attached pane.
authorNeilBrown <neil@brown.name>
Mon, 23 Nov 2015 05:38:59 +0000 (16:38 +1100)
committerNeilBrown <neil@brown.name>
Mon, 23 Nov 2015 05:38:59 +0000 (16:38 +1100)
It is fairly easy to find the leaf with pane_final_child().
It is harder to find the top.  So return that.

Signed-off-by: NeilBrown <neil@brown.name>
lib-popup.c
lib-view.c
mode-emacs.c

index b4a8b73c48781ec801684cb11eb424d8cb19ceb9..714b6d6841add2f41eebbdeb9620687dd8adc51b 100644 (file)
@@ -178,7 +178,7 @@ DEF_CMD(popup_attach)
        ci2.str2 = "Abort";
        key_handle_focus(&ci2);
 
-       ci->focus = p;
+       ci->focus = ppi->popup;
        return 1;
 }
 
index c032e4512f67d8e3deda91e2b14c60fb7c8ebe88..a088fd08ec2d8f7772746b03d1e97e4a628ace3e 100644 (file)
@@ -156,7 +156,7 @@ DEF_CMD(view_handle)
                p2 = do_view_attach(parent, pt, vd->border);
                c = pane_child(pane_child(p));
                if (c)
-                       return pane_clone(c, p2);
+                       return pane_clone(c, pane_final_child(p2));
                return 1;
        }
        if (strcmp(ci->key, "Refresh") == 0)
@@ -257,7 +257,8 @@ static struct pane *do_view_attach(struct pane *par, struct point *pt, int borde
        vd->pane = p;
        pane_check_size(p);
 
-       return view_reattach(p, pt);
+       view_reattach(p, pt);
+       return p;
 }
 
 DEF_CMD(view_attach)
index 7e07fcc7dc559c4c38230e091a0490af909d6c68..6c88175cec701cd11081cca4b5eaf724ce7fe493 100644 (file)
@@ -281,7 +281,9 @@ DEF_CMD(emacs_findfile)
                if (!p)
                        return 0;
 
-               ptp = pane_point(p);
+               ptp = pane_point(pane_final_child(p));
+               /* Want to work with the document pane */
+               p = container_of(ptp, struct pane, point);
                d = (*ptp)->doc;
                if (strncmp(ci->key, "emCX4-", 6) == 0) {
                        attr_set_str(&p->attrs, "prefix",
@@ -343,7 +345,9 @@ DEF_CMD(emacs_finddoc)
                p = pane_attach(ci->focus, "popup", NULL, "D2");
                if (!p)
                        return 0;
-               ptp = pane_point(p);
+               ptp = pane_point(pane_final_child(p));
+               /* Want to work with the document pane */
+               p = container_of(ptp, struct pane, point);
                d = (*ptp)->doc;
                if (strncmp(ci->key, "emCX4-", 6) == 0) {
                        attr_set_str(&p->attrs, "prefix",
@@ -456,9 +460,11 @@ DEF_CMD(emacs_search)
                struct point **ptp;
                if (!p)
                        return 0;
+               ptp = pane_point(pane_final_child(p));
+               /* Want to work with the document pane */
+               p = container_of(ptp, struct pane, point);
                attr_set_str(&p->attrs, "prefix", "Search: ", -1);
                attr_set_str(&p->attrs, "done-key", "Search String", -1);
-               ptp = pane_point(p);
                doc_set_name((*ptp)->doc, "Search");
                p = pane_final_child(p);
                pane_attach(p, "emacs-search", NULL, NULL);