chore: add suspend

This commit is contained in:
Kujtim Hoxha
2025-07-25 17:17:55 +02:00
parent d4b5306536
commit 39f07727c9
2 changed files with 10 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ type KeyMap struct {
Quit key.Binding
Help key.Binding
Commands key.Binding
Suspend key.Binding
Sessions key.Binding
pageBindings []key.Binding
@@ -27,6 +28,10 @@ func DefaultKeyMap() KeyMap {
key.WithKeys("ctrl+p"),
key.WithHelp("ctrl+p", "commands"),
),
Suspend: key.NewBinding(
key.WithKeys("ctrl+z"),
key.WithHelp("ctrl+z", "suspend"),
),
Sessions: key.NewBinding(
key.WithKeys("ctrl+s"),
key.WithHelp("ctrl+s", "sessions"),

View File

@@ -375,6 +375,11 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
},
)
return tea.Sequence(cmds...)
case key.Matches(msg, a.keyMap.Suspend):
if a.app.CoderAgent.IsBusy() {
return util.ReportWarn("Agent is busy, please wait...")
}
return tea.Suspend
default:
if a.dialog.HasDialogs() {
u, dialogCmd := a.dialog.Update(msg)