From 2b3cd740028c3b7b0741fb4ac45b25c5617a8d86 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Sat, 13 Jul 2024 14:54:05 -0500 Subject: [PATCH] feat(game): Make wrap help text change when toggled --- internal/game/game.go | 5 +++++ internal/game/keymap.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/game/game.go b/internal/game/game.go index 908a2b9..3df220c 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -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++ diff --git a/internal/game/keymap.go b/internal/game/keymap.go index 4e171d6..c7d976c 100644 --- a/internal/game/keymap.go +++ b/internal/game/keymap.go @@ -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(">", "."),