Skip to content

Commit a6b6704

Browse files
authored
Merge pull request #1530 from vvoland/ctrlz
tui: Handle Ctrl+z
2 parents 9eb1720 + e888356 commit a6b6704

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/tui/tui.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type appModel struct {
5959
// KeyMap defines global key bindings
6060
type KeyMap struct {
6161
Quit key.Binding
62+
Suspend key.Binding
6263
CommandPalette key.Binding
6364
ToggleYolo key.Binding
6465
ToggleHideToolResults key.Binding
@@ -75,6 +76,10 @@ func DefaultKeyMap() KeyMap {
7576
key.WithKeys("ctrl+c"),
7677
key.WithHelp("Ctrl+c", "quit"),
7778
),
79+
Suspend: key.NewBinding(
80+
key.WithKeys("ctrl+z"),
81+
key.WithHelp("Ctrl+z", "suspend"),
82+
),
7883
CommandPalette: key.NewBinding(
7984
key.WithKeys("ctrl+p"),
8085
key.WithHelp("Ctrl+p", "commands"),
@@ -583,6 +588,9 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
583588
Model: dialog.NewExitConfirmationDialog(),
584589
})
585590

591+
case key.Matches(msg, a.keyMap.Suspend):
592+
return a, tea.Suspend
593+
586594
case key.Matches(msg, a.keyMap.CommandPalette):
587595
categories := commands.BuildCommandCategories(context.Background(), a.application)
588596
return a, core.CmdHandler(dialog.OpenDialogMsg{

0 commit comments

Comments
 (0)