Skip to content

Commit

Permalink
feat(game): Make wrap help text change when toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 13, 2024
1 parent e4d66e3 commit 57889ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/game/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ func (g Game) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case key.Matches(msg, g.keymap.wrap):
g.wrap = !g.wrap
if g.wrap {
g.keymap.wrap.SetHelp(g.keymap.wrap.Help().Key, "disable wrap")
} else {
g.keymap.wrap.SetHelp(g.keymap.wrap.Help().Key, "enable wrap")
}
case key.Matches(msg, g.keymap.speedUp):
if g.speed < len(speeds)-1 {
g.speed++
Expand Down
2 changes: 1 addition & 1 deletion internal/game/keymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func newKeymap() keymap {
),
wrap: key.NewBinding(
key.WithKeys("w"),
key.WithHelp("w", "toggle wrap"),
key.WithHelp("w", "disable wrap"),
),
speedUp: key.NewBinding(
key.WithKeys(">", "."),
Expand Down

0 comments on commit 57889ee

Please sign in to comment.