Move the render's row draw beside the table's draws, as table.drawIn

This commit is contained in:
2026-09-24 13:15:23 +02:00
committed by Lillem4n
parent 14dda205f0
commit a817f21842
5 changed files with 32 additions and 33 deletions
+4 -30
View File
@@ -142,13 +142,12 @@ type pathWalk struct {
draws *pathDraws
}
// pathDraws is what a walk draws with: the session, and, for a held read of a, the
// hold keeping the variant drawn at each level, so paths sharing a prefix share it.
// a is a pointer: held inline, its level keys take an eager hold set to the heap.
// pathDraws is what a walk draws with: the session, and, for a held read, the hold
// keeping the variant drawn at each level of a, so paths sharing a prefix share it.
type pathDraws struct {
s *session
held *hold
a *arm
a *arm // a pointer: its levels slice held here moves the render's hold set to the heap
}
// walkPath descends tail from n and returns the node it ends at: a folder or
@@ -290,36 +289,11 @@ func readRow(p *pinSet, draws *pathDraws, t *table, sel string, draw bool) error
return p.selectRow(t, sel)
}
if draw && draws != nil {
draws.row(p, t)
t.drawIn(draws.s, p)
}
return nil
}
// row is the render's row of t: the one pinned in p, else one drawn inside the
// nearest pinned ancestor — its parent drawn inside that first where the ancestor
// is further up — or over the whole table, and pinned with its ancestors.
func (d *pathDraws) row(p *pinSet, t *table) int {
if r, ok := p.pinned(t); ok {
return r
}
r := -1
for a := t.parentT; a != nil && r < 0; a = a.parentT {
if _, ok := p.pinned(a); !ok {
continue
}
if t.parentT != a {
d.row(p, t.parentT)
}
pr, _ := p.pinned(t.parentT)
r = t.drawUnder(d.s, pr)
}
if r < 0 {
r = t.draw(d.s)
}
p.pin(t, r)
return r
}
// variant is the variant of c the walk continues into: the one held for this level
// of the read, drawn once, where the walk holds its draws; else one drawn afresh.
func (d *pathDraws) variant(c *choice, rest []string) node {