We open-code this a few places and will need it more soon.
It is paritcularly useful after attaching a pane which might attach a
collection.
Signed-off-by: NeilBrown <neil@brown.name>
/* FIXME do I want editor-wide attributes too? */
return NULL;
}
+
+struct pane *pane_final_child(struct pane *p)
+{
+ struct pane *c;
+
+ while ((c = pane_child(p)) != NULL)
+ p = c;
+ return p;
+}
return c;
return NULL;
}
+struct pane *pane_final_child(struct pane *p);
/* Inlines */
ptp = pane_point(ci->focus);
doc_add_view((*ptp)->doc, &esi->watch);
- while (pane_child(ci->focus))
- ci->focus = pane_child(ci->focus);
+ ci->focus = pane_final_child(ci->focus);
p = pane_register(ci->focus, 0, &search_handle, esi, NULL);
ci->focus = p;
return 1;
kd->cmdcount = 0;
kd->global = ci->comm ? 1 : 0;
p = ci->focus;
- while (pane_child(p))
- p = pane_child(p);
+ p = pane_final_child(p);
p = pane_register(p, 0, &keymap_handle, kd, NULL);
pane_check_size(p);
ci->focus = p;
attr_set_str(&p->attrs, "done-key", "Search String", -1);
ptp = pane_point(p);
doc_set_name((*ptp)->doc, "Search");
- while (pane_child(p))
- p = pane_child(p);
+ p = pane_final_child(p);
pane_attach(p, "emacs-search", NULL, NULL);
return 1;
}