The nonogram model needs terminal dimensions for mouse hit-testing, but WindowSizeMsg only fires on startup (when state is mainMenuView) and on resize. By the time the user enters gameView, no new WindowSizeMsg arrives, leaving termWidth/termHeight at 0. Send a synthetic WindowSizeMsg to the game in all three game-entry paths: spawn complete, continue game, and daily puzzle resume.
- commit
- 8f8936d995b708db2f35995cce89861a276c23c8
- parent
- 15aadfb465dde22b6db065c473e722fa1e4fbadd
- author
- Dami <dami.etoile@gmail.com>
| M | spawn.go | 1 | + |
| M | update.go | 2 | ++ |
@@ -63,6 +63,7 @@ func (m model) handleSpawnComplete(msg game.SpawnCompleteMsg) (tea.Model, tea.Cm
6363 m.game = msg.Game.SetTitle(name)6464 }6565 m.game, _ = m.game.Update(game.HelpToggleMsg{Show: m.showFullHelp})66+ m.game, _ = m.game.Update(tea.WindowSizeMsg{Width: m.width, Height: m.height})6667 m.state = gameView6768 m.completionSaved = false6869 @@ -186,6 +186,7 @@ func (m model) handleDailyPuzzle() (tea.Model, tea.Cmd) {
186186 }187187 m.game = g.SetTitle(rec.Name)188188 m.game, _ = m.game.Update(game.HelpToggleMsg{Show: m.showFullHelp})189+ m.game, _ = m.game.Update(tea.WindowSizeMsg{Width: m.width, Height: m.height})189190 m.activeGameID = rec.ID190191 m.state = gameView191192 m.completionSaved = rec.Status == store.StatusCompleted@@ -248,6 +249,7 @@ func (m model) handleContinueEnter() (tea.Model, tea.Cmd) {
248249 }249250 m.game = g.SetTitle(rec.Name)250251 m.game, _ = m.game.Update(game.HelpToggleMsg{Show: m.showFullHelp})252+ m.game, _ = m.game.Update(tea.WindowSizeMsg{Width: m.width, Height: m.height})251253 m.activeGameID = rec.ID252254 m.state = gameView253255 m.completionSaved = rec.Status == store.StatusCompleted