feat: show a quit prompt on first Ctrl-C in native TUI#2607
Conversation
|
Potential follow-up after this lands: the first |
|
This branch includes a few intermediate iterations while I refined the behavior, so squash-and-merge would probably be the cleanest merge strategy if the PR is accepted. |
|
What's the motivation for prompting after ctrl-c? |
@domenkozar accidental quit, especially because Ctrl-c is also a shortcut to copy on Linux and Windows. It's also an inspiration from Phoenix Framework; see this when typing ctrl+c
I'm also missing this feature from the previous default process manager: process compose that also prompts about exiting.
|
|
@domenkozar, please let me know any thoughts. I can adjust. Is there an open channel to talk about features? Discord, etcc? Asking that because I have a couple of other ideas. But, I think this channel here is good as well. |


Summary
This PR changes the interactive native TUI so the first
Ctrl-Cdoes not immediately quit devenv.Instead:
Ctrl-Copens a quit promptCtrl-CcorEsckeeps running and clears the promptqor a secondCtrl-Cquits devenvMotivation
Today, a single
Ctrl-Cimmediately shuts down devenv and stops all managed processes.This is easy to do by accident, especially while reading logs or working in a multi-process environment. When that happens, developers lose warm services and have to restart databases, app servers, and other managed processes unnecessarily.
This PR makes the first
Ctrl-Cnon-terminal in the interactive TUI flow so users can decide whether to keep working or quit, without interrupting managed processes on that first press.Behavior
Previous behavior:
Ctrl-Cshut down devenvNew TUI behavior:
Ctrl-Copens a quit promptcorEsckeeps running and clears the promptqorCtrl-Cquits devenv using the existing shutdown pathExpanded logs keep their existing selection-copy behavior:
Ctrl-Cstill copies selected textScope
Ctrl-Cdoes not send any signal to managed processesImplementation notes
Ctrl-Cto the process managerqor a secondCtrl-CTesting
cargo test -p devenv-tui --quietcargo test -p devenv-processes --lib --quiet