fix (desktop): ctrl-d fix to kill terminal pane#972
Conversation
📝 WalkthroughWalkthroughThis change adds Ctrl+D (EOF) detection to the Terminal component, introducing a ref to track when Ctrl+D is sent and using it to automatically close the terminal pane when the exit code is 0 and the process wasn't forcefully killed. Changes
Sequence DiagramsequenceDiagram
actor User
participant Terminal
participant useTerminalStream
participant TabsStore
User->>Terminal: Sends Ctrl+D (0x04)
Terminal->>Terminal: Detects data === "\x04"
Terminal->>Terminal: Sets ctrlDSentRef.current = true
Note over Terminal,useTerminalStream: Terminal process exits with code 0
useTerminalStream->>useTerminalStream: handleTerminalExit triggered
useTerminalStream->>useTerminalStream: Check: exitCode === 0?
useTerminalStream->>useTerminalStream: Check: ctrlDSentRef.current === true?
useTerminalStream->>useTerminalStream: Check: wasKilledByUser === false?
alt All conditions met
useTerminalStream->>TabsStore: removePane(paneId)
TabsStore->>TabsStore: Close terminal pane
else Condition not met
useTerminalStream->>useTerminalStream: Reset ctrlDSentRef.current = false
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing: stale fix from Jan 26 with no recent activity. Terminal handling has been reworked since. |
|
Hey — just a heads up, this was closed as part of an automated stale PR cleanup. If you think this was done in error, feel free to reopen it! |
|
Hey — this was closed by an automated cleanup of PRs with major merge conflicts that are 3+ weeks old. If you think this was done incorrectly, please feel free to reopen it. Sorry for any inconvenience! |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.