summaryrefslogtreecommitdiff
path: root/grid.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-09-01 13:31:39 -0400
committerPietro Gagliardi <[email protected]>2014-09-01 13:31:39 -0400
commit76c518b3e2d2787b81505c5a9f995fcde60ff8bc (patch)
tree088b46b1a02390edeb57b104ac8ef004d726f0f0 /grid.go
parent53c57267b1d267a8e0f1f3941faba07f7cc04661 (diff)
Fixed empty cells in Grid not handled correctly.
Diffstat (limited to 'grid.go')
-rw-r--r--grid.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/grid.go b/grid.go
index 5cd7d1a..7aa6c6b 100644
--- a/grid.go
+++ b/grid.go
@@ -288,17 +288,19 @@ func (g *grid) allocate(x int, y int, width int, height int, d *sizing) (allocat
for row, xcol := range g.grid {
current = nil
for col, c := range xcol {
- cell := g.controls[c]
- as := c.allocate(x + cell.xoff, y + cell.yoff, cell.width, cell.height, d)
- if current != nil { // connect first left to first right
- current.neighbor = c
+ if c != nil { // treat empty cells like spaces
+ cell := g.controls[c]
+ as := c.allocate(x + cell.xoff, y + cell.yoff, cell.width, cell.height, d)
+ if current != nil { // connect first left to first right
+ current.neighbor = c
+ }
+ if len(as) != 0 {
+ current = as[0] // next left is first subwidget
+ } else {
+ current = nil // spaces don't have allocation data
+ }
+ allocations = append(allocations, as...)
}
- if len(as) != 0 {
- current = as[0] // next left is first subwidget
- } else {
- current = nil // spaces don't have allocation data
- }
- allocations = append(allocations, as...)
x += colwidths[col] + d.xpadding
}
x = startx