From 39f07727c902b74961aea0ab64e8de8fecb3edac Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Fri, 25 Jul 2025 17:17:55 +0200 Subject: [PATCH] chore: add suspend --- internal/tui/keys.go | 5 +++++ internal/tui/tui.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/internal/tui/keys.go b/internal/tui/keys.go index d055870e5ab24816fa002d2ad4f5fc171876d56e..d618063e1ec0d51a1a9f8a15a1b83216f7d251e8 100644 --- a/internal/tui/keys.go +++ b/internal/tui/keys.go @@ -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"), diff --git a/internal/tui/tui.go b/internal/tui/tui.go index f16816ac01bacc3b51cdeda3213350a8953feb17..62d38fd595d876dad2a384f155cc01d62db59cc9 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -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)