1package sudokurgb23import (4 "charm.land/bubbles/v2/key"5 "github.com/FelineStateMachine/puzzletea/game"6)78type KeyMap struct {9 game.CursorKeyMap10 FillValue key.Binding11 ClearCell key.Binding12}1314var DefaultKeyMap = KeyMap{15 CursorKeyMap: game.DefaultCursorKeyMap,16 FillValue: key.NewBinding(17 key.WithKeys("1", "2", "3"),18 key.WithHelp("1-3", "Fill"),19 ),20 ClearCell: key.NewBinding(21 key.WithKeys("backspace"),22 key.WithHelp("bkspc", "Clear"),23 ),24}2526func (m *Model) updateKeyBindings() {27 m.keys.Up.SetEnabled(m.cursor.Y > 0)28 m.keys.Down.SetEnabled(m.cursor.Y < gridSize-1)29 m.keys.Left.SetEnabled(m.cursor.X > 0)30 m.keys.Right.SetEnabled(m.cursor.X < gridSize-1)3132 allowInteraction := !m.IsProvidedCell()33 m.keys.FillValue.SetEnabled(allowInteraction)34 m.keys.ClearCell.SetEnabled(allowInteraction)35}3637func (m Model) IsProvidedCell() bool {38 return m.providedGrid[m.cursor.Y][m.cursor.X]39}4041func (m Model) GetFullHelp() [][]key.Binding {42 return [][]key.Binding{43 {m.keys.Up, m.keys.Down, m.keys.Left, m.keys.Right},44 {m.keys.FillValue, m.keys.ClearCell},45 }46}