- [ ] 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'
pointer separate to 'focus'? Maybe panes could have optional
- 'child' method which returns main child - pane_leaf() calls that.
- Maybe pane_leaf() find a pane with z=0 and matching w,h ??
+ 'child' method which returns main child - pane_focus() calls that.
+ Maybe pane_focus() find a pane with z=0 and matching w,h ??
- [ ] support text-replace as easy as text-insert (doc:char...)
- [ ] for doc:cmd transformation, what about :Enter and BS TAB ESC ???
- [ ] For a notify handler, returning non-zero doesn't stop other handlers
return;
p->damaged &= ~damage;
if (damage & DAMAGED_REFRESH)
- pane_call(p, "Refresh", pane_leaf(p));
+ pane_call(p, "Refresh", pane_focus(p));
list_for_each_entry(c, &p->children, siblings)
c->damaged |= DAMAGED_NOT_HANDLED;
return;
if (damage & DAMAGED_VIEW)
- pane_call(p, "Refresh:view", pane_leaf(p));
+ pane_call(p, "Refresh:view", pane_focus(p));
list_for_each_entry(c, &p->children, siblings)
c->damaged |= DAMAGED_NOT_HANDLED;
break;
}
/* Tell the new focus to update - probably just a cursor update */
- p = pane_leaf(p);
+ p = pane_focus(p);
pt = call_ret(mark, "doc:point", p);
call("view:changed", p, 0, pt);
}
continue;
p->parent->focus = p;
if (old) {
- old = pane_leaf(old);
+ old = pane_focus(old);
pt = call_ret(mark, "doc:point", old);
call("view:changed", old, 0, pt);
home_call(old, "pane:defocus", focus);
}
}
- pt = call_ret(mark, "doc:point", pane_leaf(focus));
- call("view:changed", pane_leaf(focus), 0, pt);
+ pt = call_ret(mark, "doc:point", pane_focus(focus));
+ call("view:changed", pane_focus(focus), 0, pt);
call("pane:refocus", focus);
}
return pane_root(p)->timestamp == 1;
}
-static inline struct pane *safe pane_leaf(struct pane *p safe)
+static inline struct pane *safe pane_focus(struct pane *p safe)
{
struct pane *f;
/* Don't require exactly same pane for sel_owner,
* but ensure they have the same focus.
*/
- op = pane_leaf(wd->sel_owner);
- fp = pane_leaf(ci->focus);
+ op = pane_focus(wd->sel_owner);
+ fp = pane_focus(ci->focus);
if (fp != op)
return Efalse;
dest.y, dest.x, destend.y-1, destend.x-1, 0);
}
/* place the cursor */
- p1 = pane_leaf(p);
+ p1 = pane_focus(p);
pan = NULL;
while (p1 != p && (pan = pane_panel(p1, NULL)) == NULL)
p1 = p1->parent;
struct mark *pt;
xd->in_focus = in;
- p = pane_leaf(home);
+ p = pane_focus(home);
pt = call_ret(mark, "doc:point", p);
if (pt)
call("view:changed", p, 0, pt);
cme->format == 32 &&
cme->window == xd->win &&
cme->data.data32[0] == xd->atoms[a_WM_DELETE_WINDOW]) {
- call("window:close", pane_leaf(home));
+ call("window:close", pane_focus(home));
return;
}
new = p->pane->focus;
if (*which == 'r')
new = pane_root(p->pane);
- if (*which == 'L')
- new = pane_leaf(p->pane);
+ if (*which == 'F')
+ new = pane_focus(p->pane);
if (new == NULL) {
Py_INCREF(Py_None);
newpane = (Pane*)Py_None;
{"root",
(getter)pane_getpane, (setter)pane_nosetpane,
"Root pane", "r"},
- {"leaf",
+ {"final_focus",
(getter)pane_getpane, (setter)pane_nosetpane,
- "Leaf pane", "L"},
+ "Leaf pane", "F"},
{NULL} /* Sentinel */
};
/* No display!!! */
return Efalse;
- p2 = call_ret(pane, "PopupTile", pane_leaf(cr.p), 0, NULL, "DM3sta");
+ p2 = call_ret(pane, "PopupTile", pane_focus(cr.p), 0, NULL, "DM3sta");
if (!p2)
return Efalse;
}
if (!im->focus || im->focus->focus) {
- p = pane_leaf(ci->focus);
+ p = pane_focus(ci->focus);
im->focus = p;
pane_add_notify(ci->home, p, "Notify:Close");
}
DEF_CMD(linecount_restart)
{
- pane_call(ci->home, "CountLinesAsync", pane_leaf(ci->focus), 1);
+ pane_call(ci->home, "CountLinesAsync", pane_focus(ci->focus), 1);
return Efalse;
}
if (strcmp(ci->key, "Filter:set") == 0) {
if (!ci->str)
return Enoarg;
- call("view:changed", pane_leaf(ci->home));
+ call("view:changed", pane_focus(ci->home));
comm = ci->comm2;
fd->explicit_set = True;
free(fd->match);
fd->implicit_set = False;
if (check_settings(ci->focus, fd))
/* Something changed */
- call("view:changed", pane_leaf(ci->home));
+ call("view:changed", pane_focus(ci->home));
}
if (!fd->match)
return 1;
/* First find the size */
lh = line_height(p, xyscale.x);
- bhs = pane_attr_get(pane_leaf(p), "border-height");
+ bhs = pane_attr_get(pane_focus(p), "border-height");
if (bhs)
bh = atoi(bhs);
if (bh <= 0)
bh = line_height(p, 0); /* border height */
- bws = pane_attr_get(pane_leaf(p), "border-width");
+ bws = pane_attr_get(pane_focus(p), "border-width");
if (bws)
bw = atoi(bhs);
if (bw <= 0)
{
struct popup_info *ppi = ci->home->data;
char *prompt, *dflt, *prefix;
- struct pane *focus = pane_leaf(ci->home);
+ struct pane *focus = pane_focus(ci->home);
prefix = pane_attr_get(focus, "prefix");
prompt = pane_attr_get(focus, "prompt");
t = list_next_entry(t, tiles);
f = t->content;
if (f) {
- f = pane_leaf(f);
+ f = pane_focus(f);
n = pane_attr_get(f, "doc-name");
if (name && n && strcmp(n, name) == 0)
return comm_call(ci->comm2, "callback:pane",
/* big scroll down */
scale = 900;
}
- call("Move-View", pane_leaf(ci->focus), num * scale);
+ call("Move-View", pane_focus(ci->focus), num * scale);
return 1;
}
DEF_CMD(view_scroll)
{
if (strcmp(ci->key, "M:Press-4") == 0)
- call("Move-View", pane_leaf(ci->focus), -200);
+ call("Move-View", pane_focus(ci->focus), -200);
else
- call("Move-View", pane_leaf(ci->focus), 200);
+ call("Move-View", pane_focus(ci->focus), 200);
return 1;
}
edlib.time_start(edlib.TIME_WINDOW)
self.im.focus_in()
self.in_focus = True
- f = self.leaf
+ f = self.final_focus
pt = f.call("doc:point", ret='mark')
f.call("view:changed", pt)
self.call("pane:refocus")
edlib.time_start(edlib.TIME_WINDOW)
self.im.focus_out()
self.in_focus = False
- f = self.leaf
+ f = self.final_focus
pt = f.call("doc:point", ret='mark')
f.call("view:changed", pt)
edlib.time_stop(edlib.TIME_WINDOW)
return edlib.Efalse
self.set_time()
- focus = focus.leaf
+ focus = focus.final_focus
if edlib.testing:
remain = 20
self['done-key'] = "N:%s:%s:%s" % (self['autosave'], self['mode'], d)
# FIXME this only damaged the board content, not doc content
# Is there a way I can communicate that?
- focus.leaf.call("view:changed")
+ focus.final_focus.call("view:changed")
return 1
def down(self, key, focus, **a):
self['dirname'] = d
self['pane-title'] = "%s in %s" % (self['cmd'],d)
self['done-key'] = "N:%s:%s:%s" % (self['autosave'], self['mode'], d)
- focus.leaf.call("view:changed")
+ focus.final_focus.call("view:changed")
return 1
def isword(c):
self.sock.send(b"FAIL")
return 1
if self.term:
- p = self.term.leaf.call("ThisPane", ret='pane')
+ p = self.term.final_focus.call("ThisPane", ret='pane')
p = d.call("doc:attach-view", p, 1, ret='pane')
self.term.take_focus()
self.sock.send(b"OK")
self.destpane = None
self.call("editor:notify:all-displays", self.display_callback)
if self.destpane:
- p = self.destpane.leaf
+ p = self.destpane.final_focus
self.destpane = None
# Need to avoid transient popups
if p:
if self.thread_start:
# Possible insertion before thread_end - recalc.
self.thread_end = self.thread_start.dup()
- self.leaf.call("doc:step-thread", 1, 1, self.thread_end)
- self.leaf.call("view:changed")
+ self.final_focus.call("doc:step-thread", 1, 1, self.thread_end)
+ self.final_focus.call("view:changed")
self.call("doc:notify:doc:status-changed")
return edlib.Efallthrough
return None
# old thread is disappearing. If it is not gone, clip marks
# to start, else clip to next thread.
- self.leaf.call("Notify:clip", self.thread_start, self.thread_end,
+ self.final_focus.call("Notify:clip", self.thread_start, self.thread_end,
0 if gone else 1)
if self.whole_thread:
# And clip anything after (at eof) to thread_end
eof = edlib.Mark(self)
- self.leaf.call("doc:set-ref", eof, 0)
+ self.final_focus.call("doc:set-ref", eof, 0)
eof.step(1)
eof.index = 1 # make sure all eof marks are different
- self.leaf.call("Notify:clip", self.thread_end, eof, 1)
+ self.final_focus.call("Notify:clip", self.thread_end, eof, 1)
eof.index = 0
- self.leaf.call("view:changed", self.thread_start, self.thread_end)
+ self.final_focus.call("view:changed", self.thread_start, self.thread_end)
self.selected = None
self.thread_start = None
self.thread_end = None
# might be where thread used to be.
self.thread_end = self.thread_start.dup()
self.call("doc:step-thread", self.thread_end, 1, 1)
- self.leaf.call("view:changed", self.thread_start, self.thread_end)
+ self.final_focus.call("view:changed", self.thread_start, self.thread_end)
return 1
def find_message(self, key, focus, mark, str, str2, **a):
if mt != "True":
m2 = m.dup()
self.call("doc:step-matched", m2, 1, 1)
- self.leaf.call("Notify:clip", m, m2)
+ self.final_focus.call("Notify:clip", m, m2)
m = m2
if not self.thread_matched:
self.thread_matched = m.dup()
self.parent.next(m)
- self.leaf.call("view:changed", self.thread_start, self.thread_end)
+ self.final_focus.call("view:changed", self.thread_start, self.thread_end)
def handle_notify_thread(self, key, str, num, **a):
"handle:notmuch:thread-changed"
focus.call("Notify:clip", self.thread_start, self.thread_end)
# everything after to EOF moves to thread_end.
eof = edlib.Mark(self)
- self.leaf.call("doc:set-ref", eof, 0)
+ self.final_focus.call("doc:set-ref", eof, 0)
eof.step(1)
eof.offset = 1 # make sure all eof marks are different
- self.leaf.call("Notify:clip", self.thread_end, eof, 1)
+ self.final_focus.call("Notify:clip", self.thread_end, eof, 1)
eof.offset = 0
self['doc-status'] = "Query: %s" % self['qname']
m['quote-hidden'] = "no"
else:
m['quote-hidden'] = "yes"
- self.leaf.call("view:changed", m, m.next())
+ self.final_focus.call("view:changed", m, m.next())
return 1
def handle_vis(self, focus, mark, which):
def handle_replace(self, key, focus, **a):
"handle:doc:replaced"
- self.update(self.leaf, self.pre_paren)
+ self.update(self.final_focus, self.pre_paren)
self.pre_paren = None
- self.update(self.leaf, self.post_paren)
+ self.update(self.final_focus, self.post_paren)
self.post_paren = None
self.damaged(edlib.DAMAGED_VIEW)
return 1
self['background'] = 'call:Present-BG:'+globals['background']
if 'scale' in globals:
self['scale'] = globals['scale']
- self.leaf.call("view:changed")
+ self.final_focus.call("view:changed")
return maybe
else:
# not part of start-of-page block
first.release()
if extra_change:
# force full refresh
- self.leaf.call("view:changed")
+ self.final_focus.call("view:changed")
def get_local_attr(self, m, attr, page):
t = 'attr:' + attr
self.first_valid = False
page['valid'] = 'no'
# attributes probably changed so...
- self.leaf.call("view:changed")
+ self.final_focus.call("view:changed")
else:
page['valid'] = 'no'
page['next-valid'] = 'no'
l['type'] = 'unknown'
l = l.prev()
if l['type'] and l['type'][0:5] == "attr:":
- self.leaf.call("view:changed")
+ self.final_focus.call("view:changed")
l['type'] = 'unknown'
l = l.next()
if l:
m2.to_mark(m)
if comm2 is not None:
comm2("callback", focus, m)
- self.leaf.call("Move-View-Pos", m2)
+ self.final_focus.call("Move-View-Pos", m2)
return 1
def handle_clone(self, key, **a):
* However we cannot currently access the view port, so
* always signal damage. FIXME.
*/
- call("view:changed", pane_leaf(ci->home));
+ call("view:changed", pane_focus(ci->home));
return 1;
}