Skip to content

Commit 276f114

Browse files
committed
Add support for job-control suspend (ctrl+z/SIGSTP).
Fixes anomalyco#584. This allows you to drop out of opencode, run some things in your shell, and resume opencode. Pressing ctrl+z suspends the opencode job in your shell, you can run `fg` to resume it. This was surprisingly easy to add. It seems like bubbletea handles switching to/from raw mode on suspend/resume. I've tested suspending/resuming opencode and my terminal remains clean. See: https://github.com/charmbracelet/bubbletea/pull/1054/files#diff-d97478697adeda9d52cdf576d22266813b2fd5c030ec40dc2576c255347cfa2eR13-R24
1 parent d465f15 commit 276f114

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/tui/internal/tui

‎packages/tui/internal/tui/tui.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
114114
case tea.KeyPressMsg:
115115
keyString := msg.String()
116116

117+
// Handle Ctrl+Z for suspend
118+
if keyString == "ctrl+z" {
119+
return a, tea.Suspend
120+
}
121+
117122
// 1. Handle active modal
118123
if a.modal != nil {
119124
switch keyString {

0 commit comments

Comments
 (0)