clone

fifteen puzzle games for the terminal, with daily puzzles, weekly ladders and xp, built on bubble tea

fix: resolve Reset panics on imported games, double-input from key release, view overflow mangling, and nonogram mouse offset

Dami committed eb8440f
- Restore initialGrid in takuzu/lightsout ImportModel to prevent nil
  slice panic when pressing Ctrl+R on saved/completed puzzles
- Persist modeTitle in hashiwokakero/sudoku save data so title bar
  renders correctly after loading a saved game
- Switch all puzzle Update handlers from tea.KeyMsg to tea.KeyPressMsg
  so key release events no longer trigger duplicate side effects
- Cap game view width to terminal width before centering to prevent
  JoinVertical(Center) status bar inflation from causing line wrapping
- Remove phantom empty line from JoinVertical when debug is off, fixing
  nonogram mouse Y offset being off by one row
- Account for MaxWidth capping in nonogram gridOrigin so horizontal
  hit-testing stays accurate on narrow terminals
- Add ListHeight helper and disable pagination to prevent list rendering
  glitches on resize
commit
eb8440f4cd777f76eea1935b3a143213fd7d5b38
parent
8f8936d995b708db2f35995cce89861a276c23c8
author
Dami <dami.etoile@gmail.com>
16 files changed, +110 -60
Mgame/cursor.go2+-
Mhashiwokakero/Export.go19++++++++------
Mhashiwokakero/Model.go6++--
Mhitori/Model.go2+-
Mlightsout/Export.go42++++++++++++++++++++----------
Mlightsout/Model.go2+-
Mnonogram/mouse.go5++++
Mshikaku/Model.go6++--
Msudoku/Export.go11+++++---
Msudoku/Model.go2+-
Mtakuzu/Export.go22+++++++++++----
Mtakuzu/Model.go2+-
Mui/list.go16+++++++++++
Mupdate.go14+++++-----
Mview.go15+++++------
Mwordsearch/Model.go4+-
M game/cursor.go +1 -1
M hashiwokakero/Export.go +11 -8
M hashiwokakero/Model.go +3 -3
M hitori/Model.go +1 -1
M lightsout/Export.go +28 -14
M lightsout/Model.go +1 -1
M nonogram/mouse.go +5 -0
M shikaku/Model.go +3 -3
M sudoku/Export.go +7 -4
M sudoku/Model.go +1 -1
M takuzu/Export.go +16 -6
M takuzu/Model.go +1 -1
M ui/list.go +16 -0
M update.go +7 -7
@@ -25,18 +25,18 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
2525 case tea.WindowSizeMsg:2626 m.width = msg.Width2727 m.height = msg.Height28- menuW, menuH := min(m.width, 64), min(m.height, 24)29- m.mainMenuList.SetSize(menuW, menuH)30- m.gameSelectList.SetSize(menuW, menuH)28+ menuW := min(m.width, 64)29+ m.mainMenuList.SetSize(menuW, min(m.height, ui.ListHeight(m.mainMenuList)))30+ m.gameSelectList.SetSize(menuW, min(m.height, ui.ListHeight(m.gameSelectList)))3131 if m.state == modeSelectView {32- m.modeSelectList.SetSize(menuW, menuH)32+ m.modeSelectList.SetSize(menuW, min(m.height, ui.ListHeight(m.modeSelectList)))3333 }3434 if m.state == continueView {3535 m.continueTable.SetWidth(m.width)3636 m.continueTable.SetHeight(m.height)3737 }3838 if m.state == helpSelectView {39- m.helpSelectList.SetSize(menuW, menuH)39+ m.helpSelectList.SetSize(menuW, min(m.height, ui.ListHeight(m.helpSelectList)))4040 }4141 if m.state == helpDetailView {4242 m.helpViewport.SetWidth(m.width)
@@ -152,7 +152,7 @@ func (m model) handleMainMenuEnter() (tea.Model, tea.Cmd) {
152152 m.state = continueView153153 case "Guides":154154 m.helpSelectList = ui.InitList(GameCategories, "How to Play")155- m.helpSelectList.SetSize(min(m.width, 64), min(m.height, 24))155+ m.helpSelectList.SetSize(min(m.width, 64), min(m.height, ui.ListHeight(m.helpSelectList)))156156 m.state = helpSelectView157157 case "Quit":158158 return m, tea.Quit
@@ -216,7 +216,7 @@ func (m model) handleGameSelectEnter() (tea.Model, tea.Cmd) {
216216 }217217 m.selectedCategory = cat218218 m.modeSelectList = ui.InitList(cat.Modes, cat.Name+" - Select Mode")219- m.modeSelectList.SetSize(m.gameSelectList.Width(), m.gameSelectList.Height())219+ m.modeSelectList.SetSize(min(m.width, 64), min(m.height, ui.ListHeight(m.modeSelectList)))220220 m.state = modeSelectView221221 return m, nil222222 }
M view.go +7 -8
M wordsearch/Model.go +2 -2