From 1a2e0dbf20adef66e4698b8193dba6810c81363d Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Mon, 5 Feb 2024 08:00:04 -0800 Subject: [PATCH] change uninitialized colCache value from -1 to 0 --- widget/gridwrap.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/widget/gridwrap.go b/widget/gridwrap.go index 7d638eb9ab..9ee8a118b8 100644 --- a/widget/gridwrap.go +++ b/widget/gridwrap.go @@ -52,7 +52,7 @@ type GridWrap struct { // // Since: 2.4 func NewGridWrap(length func() int, createItem func() fyne.CanvasObject, updateItem func(GridWrapItemID, fyne.CanvasObject)) *GridWrap { - gwList := &GridWrap{Length: length, CreateItem: createItem, UpdateItem: updateItem, colCountCache: -1} + gwList := &GridWrap{Length: length, CreateItem: createItem, UpdateItem: updateItem} gwList.ExtendBaseWidget(gwList) return gwList } @@ -149,7 +149,7 @@ func (l *GridWrap) RefreshItem(id GridWrapItemID) { // Resize is called when this GridWrap should change size. We refresh to ensure invisible items are drawn. func (l *GridWrap) Resize(s fyne.Size) { - l.colCountCache = -1 + l.colCountCache = 0 l.BaseWidget.Resize(s) l.offsetUpdated(l.scroller.Offset) l.scroller.Content.(*fyne.Container).Layout.(*gridWrapLayout).updateGrid(true) @@ -558,7 +558,7 @@ func (l *gridWrapLayout) setupGridItem(li *gridWrapItem, id GridWrapItemID, focu } func (l *GridWrap) getColCount() int { - if l.colCountCache < 0 { + if l.colCountCache < 1 { padding := theme.Padding() l.colCountCache = 1 width := l.Size().Width