diff --git a/help.go b/help.go index 09de177..1122996 100644 --- a/help.go +++ b/help.go @@ -44,6 +44,18 @@ func usage(keyMap KeyMap) string { ) } +func help(keyMap KeyMap) string { + title := lipgloss.NewStyle().Bold(true) + pad := lipgloss.NewStyle().PaddingLeft(4) + return fmt.Sprintf(` + %v +%v +`, + title.Render("Key Bindings"), + strings.Join(keyMapInfo(keyMap, pad), "\n"), + ) +} + func keyMapInfo(keyMap KeyMap, style lipgloss.Style) []string { v := reflect.ValueOf(keyMap) fields := reflect.VisibleFields(v.Type()) diff --git a/main.go b/main.go index 026a127..d23cd8d 100644 --- a/main.go +++ b/main.go @@ -387,7 +387,7 @@ func (m *model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { return m, tea.Quit case key.Matches(msg, keyMap.Help): - m.help.SetContent(strings.Join(keyMapInfo(keyMap, lipgloss.NewStyle().Padding(1, 2)), "\n")) + m.help.SetContent(help(keyMap)) m.showHelp = true case key.Matches(msg, keyMap.Up):