- [ ] send warning message when recursive notification is prohibited.
editor:notify:Message:broadcast
- [ ] Make DEF_CB really different from DEF_CMD and ensure it is used properly.
-- [ ] is DocLeaf really a good idea? Maybe panes should have 'leafward'
+- [X] is DocLeaf really a good idea? Maybe panes should have 'leafward'
pointer separate to 'focus'? Maybe panes could have optional
'child' method which returns main child - pane_focus() calls that.
Maybe pane_focus() find a pane with z=0 and matching w,h ??
messageline_msg which wants to allow fallthrough, but needs to acknowledge.
How can I resolve this? Use Efallthrough as -1.
- [ ] make a doc read-only if dir doesn't exist or isn't writable
+- [ ] change some pane_focus() to pane_leaf() where appropriate.
- [ ] account all mem allocation types separately, and (optionally) report
stats regularly
- [ ] document the use of doc:replaced. What are the two
return c;
}
+struct pane * safe pane_leaf(struct pane *p safe)
+{
+ /* Find the only child with ->z of zero,
+ * and recurse on that.
+ * This ignores popups and stops when a pane
+ * splits.
+ */
+ struct pane *l = p;
+
+ while (l) {
+ struct pane *c;
+ p = l;
+ l = NULL;
+ list_for_each_entry(c, &p->children, siblings) {
+ if (c->z)
+ continue;
+ if (!l) {
+ l = c;
+ continue;
+ }
+ /* Two candidates, so further leaf - stop here */
+ l = NULL;
+ break;
+ }
+ }
+ return p;
+}
+
DEF_CB(take_simple)
{
struct call_return *cr = container_of(ci->comm, struct call_return, c);
return rv;
}
void pane_free(struct pane *p safe);
+struct pane * safe pane_leaf(struct pane *p safe);
/* Inlines */
new = pane_root(p->pane);
if (*which == 'F')
new = pane_focus(p->pane);
+ if (*which == 'L')
+ new = pane_leaf(p->pane);
if (new == NULL) {
Py_INCREF(Py_None);
newpane = (Pane*)Py_None;
"Root pane", "r"},
{"final_focus",
(getter)pane_getpane, (setter)pane_nosetpane,
- "Leaf pane", "F"},
+ "Final focus pane", "F"},
+ {"leaf",
+ (getter)pane_getpane, (setter)pane_nosetpane,
+ "Leaf pane", "L"},
{NULL} /* Sentinel */
};
}
/* Find where 'focus' is open */
name = pane_attr_get(ci->focus, "doc-name");
+ if (!name)
+ return Efallthrough;
if (!ti->leaf)
ti = tile_first(ti);
t = ti;
t = list_next_entry(t, tiles);
f = t->content;
if (f) {
- f = pane_focus(f);
+ f = pane_leaf(f);
n = pane_attr_get(f, "doc-name");
- if (name && n && strcmp(n, name) == 0)
+ if (n && strcmp(n, name) == 0)
return comm_call(ci->comm2, "callback:pane",
- strcmp(ci->key, "DocLeaf") == 0
- ? f : t->p,
+ t->p,
0, NULL, t->name);
}
} while (t != ti);
key_add(tile_map, "OtherPane", &tile_other);
key_add(tile_map, "ThisPane", &tile_this);
key_add(tile_map, "DocPane", &tile_doc);
- key_add(tile_map, "DocLeaf", &tile_doc);
key_add(tile_map, "RootPane", &tile_root);
key_add(tile_map, "Clone", &tile_clone);
key_add(tile_map, "Child-Notify", &tile_child_notify);
focus.call("Message", "File %s not found" % fname)
return edlib.Efail
- par = focus.call("DocLeaf", d, ret='pane')
+ par = focus.call("DocPane", d, ret='pane')
+ if par:
+ par = par.leaf
if not par:
par = focus.call("OtherPane", d, ret='pane')
if not par:
else:
in_popup = True
if where in ['OtherPane', 'AnyPane']:
- par = focus.call("DocLeaf", d, ret='pane')
+ par = focus.call("DocPane", d, ret='pane')
if par:
- pass
+ par = par.leaf
elif where == 'OtherPane':
pane = focus.call(where, ret='pane')
else: