Enter every row a read pins before walking on, and skip a cell outside an entered ancestor's row
Tests / vet + fmt + tests (pull_request) Successful in 1m8s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped

This commit is contained in:
2026-09-17 16:13:59 +02:00
parent aea7b72e4b
commit c314f9cb57
3 changed files with 34 additions and 15 deletions
+10
View File
@@ -465,6 +465,16 @@ func (t *table) descendant(name string) *table {
// parentRow is the row of t's parent that row r links to.
func (t *table) parentRow(r int) int { return t.parentT.byKey[t.cell(r, t.parent)] }
// descends reports whether a is an ancestor of t.
func (t *table) descends(a *table) bool {
for p := t.parentT; p != nil; p = p.parentT {
if p == a {
return true
}
}
return false
}
// under reports whether row r of t sits inside row pr of ancestor a.
func (t *table) under(r int, a *table, pr int) bool {
for c, row := t, r; c.parentT != nil; c, row = c.parentT, c.parentRow(row) {