Hold every whole draw's row a walk is in, so a nested whole draw keeps the outer one's
This commit is contained in:
+3
-3
@@ -412,9 +412,9 @@ another never meet, and each may select its own row of another table; the cells
|
|||||||
row, and whatever they reach, do meet, and so does the format beside them. The rule the
|
row, and whatever they reach, do meet, and so does the format beside them. The rule the
|
||||||
fence applies is that two reads meet unless they sit in rows that never render together:
|
fence applies is that two reads meet unless they sit in rows that never render together:
|
||||||
rows falling under different rows of a table a path pinned, two rows of that table
|
rows falling under different rows of a table a path pinned, two rows of that table
|
||||||
itself included. A table read whole draws its row apart from every pin, so its rows
|
itself included. A table read whole draws its row apart from every pin, so the rows of
|
||||||
are alternatives only to each other, and a cell of one meets a read pinning a region
|
one whole read are alternatives only to each other, and a cell of one meets a read
|
||||||
the row is not in. A choice's items get no such treatment yet: two items selecting
|
pinning an ancestor row the row is not under. A choice's items get no such treatment yet: two items selecting
|
||||||
different rows are still refused.
|
different rows are still refused.
|
||||||
|
|
||||||
## A table never reaches its own family, by any route
|
## A table never reaches its own family, by any route
|
||||||
|
|||||||
+6
-10
@@ -179,14 +179,14 @@ type drawWalk struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// drawAt is where a walk stands: the draw group it draws in, how the render's root reached it, the
|
// drawAt is where a walk stands: the draw group it draws in, how the render's root reached it, the
|
||||||
// table rows it pinned, the table a whole read draws a row of, and the row of it whose cells the
|
// table rows it pinned, the table a whole read draws a row of, and the rows of whole draws whose
|
||||||
// walk is in.
|
// cells the walk is in.
|
||||||
type drawAt struct {
|
type drawAt struct {
|
||||||
group string
|
group string
|
||||||
route drawRoute
|
route drawRoute
|
||||||
alt pinSet
|
alt pinSet
|
||||||
drawn *table // left out of the visit keys: only this table's own cells compare against it, which the own-family fence keeps true
|
drawn *table // left out of the visit keys: only this table's own cells compare against it, which the own-family fence keeps true
|
||||||
whole tablePin
|
whole pinSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// drawRoute is how a render reaches a draw: as its author spells it, and the root edge's label.
|
// drawRoute is how a render reaches a draw: as its author spells it, and the root edge's label.
|
||||||
@@ -239,7 +239,8 @@ func (w *drawWalk) walk(n node, at drawAt) {
|
|||||||
w.edge(n, e, at)
|
w.edge(n, e, at)
|
||||||
case cell.cellOf == at.drawn:
|
case cell.cellOf == at.drawn:
|
||||||
in := at
|
in := at
|
||||||
in.whole = tablePin{cell.cellOf, cell.cellRow}
|
in.whole = at.whole.clone()
|
||||||
|
in.whole.add(cell.cellOf, cell.cellRow)
|
||||||
w.edge(n, e, in)
|
w.edge(n, e, in)
|
||||||
case at.alt.clash(cell.cellOf, cell.cellRow) == nil:
|
case at.alt.clash(cell.cellOf, cell.cellRow) == nil:
|
||||||
in := at
|
in := at
|
||||||
@@ -250,12 +251,7 @@ func (w *drawWalk) walk(n node, at drawAt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rowsKey spells the rows the walk stands in, pinned and whole, for a map.
|
// rowsKey spells the rows the walk stands in, pinned and whole, for a map.
|
||||||
func (at drawAt) rowsKey() string {
|
func (at drawAt) rowsKey() string { return at.alt.key() + "|" + at.whole.key() }
|
||||||
if at.whole.t == nil {
|
|
||||||
return at.alt.key()
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s%p{%d}", at.alt.key(), at.whole.t, at.whole.row)
|
|
||||||
}
|
|
||||||
|
|
||||||
// edge records the reference an edge reads, then walks on with every row the read
|
// edge records the reference an edge reads, then walks on with every row the read
|
||||||
// pins entered, so a selected row renders only its own cells.
|
// pins entered, so a selected row renders only its own cells.
|
||||||
|
|||||||
@@ -219,15 +219,4 @@ func checkOwnFamily(t *template) error {
|
|||||||
// alternatives reports whether two reads sit in different rows of one table: rows the walks pinned,
|
// alternatives reports whether two reads sit in different rows of one table: rows the walks pinned,
|
||||||
// or rows of one whole draw.
|
// or rows of one whole draw.
|
||||||
// docs/decisions.md#the-rows-of-a-table-are-alternatives
|
// docs/decisions.md#the-rows-of-a-table-are-alternatives
|
||||||
func alternatives(a, b drawAt) bool {
|
func alternatives(a, b drawAt) bool { return a.alt.differs(&b.alt) || a.whole.differs(&b.whole) }
|
||||||
if a.whole.t != nil && a.whole.t == b.whole.t && a.whole.row != b.whole.row {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
found := false
|
|
||||||
a.alt.each(func(t *table, r int) {
|
|
||||||
if br, in := b.alt.pinned(t); in && br != r {
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return found
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -153,6 +153,17 @@ func (p pinSet) entered(t *table, r int) pinSet {
|
|||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// differs reports whether p and q hold different rows of one table.
|
||||||
|
func (p *pinSet) differs(q *pinSet) bool {
|
||||||
|
found := false
|
||||||
|
p.each(func(t *table, r int) {
|
||||||
|
if qr, in := q.pinned(t); in && qr != r {
|
||||||
|
found = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
// key spells the set for a map, by the tables' identities in path order.
|
// key spells the set for a map, by the tables' identities in path order.
|
||||||
func (p *pinSet) key() string {
|
func (p *pinSet) key() string {
|
||||||
var pins []tablePin
|
var pins []tablePin
|
||||||
|
|||||||
Reference in New Issue
Block a user