Skip to content

Commit 7e0c54a

Browse files
committed
Separate status bar bindings from help dialog bindings
Created two separate methods: - Bindings() - Returns curated subset for status bar (existing behavior) - AllBindings() - Returns comprehensive list for help dialog This way the help dialog shows ALL available shortcuts (Ctrl+y, Ctrl+o, Ctrl+s, Ctrl+m, Ctrl+x, Ctrl+z, Ctrl+b) while the status bar remains uncluttered and only shows the most essential commands. Fixes the issue where adding bindings to show in help would also crowd the status bar unnecessarily. Assisted-By: docker-agent
1 parent 85e2038 commit 7e0c54a

1 file changed

Lines changed: 64 additions & 4 deletions

File tree

pkg/tui/tui.go

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ func (m *appModel) Help() help.KeyMap {
15531553
return core.NewSimpleHelp(m.Bindings())
15541554
}
15551555

1556-
// Bindings returns the key bindings shown in the status bar.
1556+
// Bindings returns the key bindings shown in the status bar (a curated subset).
15571557
func (m *appModel) Bindings() []key.Binding {
15581558
quitBinding := key.NewBinding(
15591559
key.WithKeys("ctrl+c"),
@@ -1582,7 +1582,67 @@ func (m *appModel) Bindings() []key.Binding {
15821582
key.WithHelp("Ctrl+h", "help"),
15831583
))
15841584

1585-
// Additional global shortcuts
1585+
// Show newline help based on keyboard enhancement support
1586+
if m.keyboardEnhancementsSupported {
1587+
bindings = append(bindings, key.NewBinding(
1588+
key.WithKeys("shift+enter"),
1589+
key.WithHelp("Shift+Enter", "newline"),
1590+
))
1591+
} else {
1592+
bindings = append(bindings, key.NewBinding(
1593+
key.WithKeys("ctrl+j"),
1594+
key.WithHelp("Ctrl+j", "newline"),
1595+
))
1596+
}
1597+
1598+
if m.focusedPanel == PanelContent {
1599+
bindings = append(bindings, m.chatPage.Bindings()...)
1600+
} else {
1601+
editorName := getEditorDisplayNameFromEnv(os.Getenv("VISUAL"), os.Getenv("EDITOR"))
1602+
bindings = append(bindings,
1603+
key.NewBinding(
1604+
key.WithKeys("ctrl+g"),
1605+
key.WithHelp("Ctrl+g", "edit in "+editorName),
1606+
),
1607+
key.NewBinding(
1608+
key.WithKeys("ctrl+r"),
1609+
key.WithHelp("Ctrl+r", "history search"),
1610+
),
1611+
)
1612+
}
1613+
return bindings
1614+
}
1615+
1616+
// AllBindings returns ALL available key bindings for the help dialog (comprehensive list).
1617+
func (m *appModel) AllBindings() []key.Binding {
1618+
quitBinding := key.NewBinding(
1619+
key.WithKeys("ctrl+c"),
1620+
key.WithHelp("Ctrl+c", "quit"),
1621+
)
1622+
1623+
if m.leanMode {
1624+
return []key.Binding{quitBinding}
1625+
}
1626+
1627+
tabBinding := key.NewBinding(
1628+
key.WithKeys("tab"),
1629+
key.WithHelp("Tab", "switch focus"),
1630+
)
1631+
1632+
bindings := []key.Binding{quitBinding, tabBinding}
1633+
bindings = append(bindings, m.tabBar.Bindings()...)
1634+
1635+
bindings = append(bindings, key.NewBinding(
1636+
key.WithKeys("ctrl+k"),
1637+
key.WithHelp("Ctrl+k", "commands"),
1638+
))
1639+
1640+
bindings = append(bindings, key.NewBinding(
1641+
key.WithKeys("ctrl+h"),
1642+
key.WithHelp("Ctrl+h", "help"),
1643+
))
1644+
1645+
// Additional global shortcuts (not in status bar, but available)
15861646
bindings = append(bindings, key.NewBinding(
15871647
key.WithKeys("ctrl+y"),
15881648
key.WithHelp("Ctrl+y", "toggle yolo mode"),
@@ -1732,9 +1792,9 @@ func (m *appModel) handleKeyPress(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
17321792
return m, core.CmdHandler(messages.ClearQueueMsg{})
17331793

17341794
case key.Matches(msg, key.NewBinding(key.WithKeys("ctrl+h", "f1", "ctrl+?"))):
1735-
// Show contextual help dialog with all currently active key bindings
1795+
// Show contextual help dialog with ALL available key bindings
17361796
return m, core.CmdHandler(dialog.OpenDialogMsg{
1737-
Model: dialog.NewHelpDialog(m.Bindings()),
1797+
Model: dialog.NewHelpDialog(m.AllBindings()),
17381798
})
17391799
}
17401800

0 commit comments

Comments
 (0)