Skip to content

feat: show a quit prompt on first Ctrl-C in native TUI#2607

Merged
domenkozar merged 5 commits into
cachix:mainfrom
sadjow:feat/native-double-ctrl-c
Mar 16, 2026
Merged

feat: show a quit prompt on first Ctrl-C in native TUI#2607
domenkozar merged 5 commits into
cachix:mainfrom
sadjow:feat/native-double-ctrl-c

Conversation

@sadjow

@sadjow sadjow commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR changes the interactive native TUI so the first Ctrl-C does not immediately quit devenv.

Instead:

  • the first Ctrl-C opens a quit prompt
  • managed processes keep running after that first Ctrl-C
  • c or Esc keeps running and clears the prompt
  • q or a second Ctrl-C quits devenv

Motivation

Today, a single Ctrl-C immediately 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-C non-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:

  • first Ctrl-C shut down devenv
  • managed processes were stopped as part of manager shutdown

New TUI behavior:

  • first Ctrl-C opens a quit prompt
  • managed processes continue running
  • c or Esc keeps running and clears the prompt
  • q or Ctrl-C quits devenv using the existing shutdown path

Expanded logs keep their existing selection-copy behavior:

  • Ctrl-C still copies selected text
  • when there is no active selection, the quit prompt flow above applies

Scope

  • interactive TUI path with the native process manager only
  • non-TUI foreground behavior is unchanged
  • the first Ctrl-C does not send any signal to managed processes

Implementation notes

  • reuses the TUI interrupt prompt state without forwarding the first Ctrl-C to the process manager
  • keeps quit handling on q or a second Ctrl-C
  • removes the earlier broadcast-interrupt manager command from this draft
  • renders the prompt in both the main view and expanded logs view

Testing

  • cargo test -p devenv-tui --quiet
  • cargo test -p devenv-processes --lib --quiet
  • docs and changelog updates
image

@sadjow sadjow changed the title draft: forward first Ctrl-C to native processes and allow continue in TUI feat: forward first Ctrl-C to native processes and allow continue in TUI Mar 12, 2026
@sadjow sadjow marked this pull request as ready for review March 12, 2026 00:50
@sadjow sadjow marked this pull request as draft March 12, 2026 01:09
@sadjow sadjow changed the title feat: forward first Ctrl-C to native processes and allow continue in TUI feat: forward first Ctrl-C to managed processes in TUI Mar 12, 2026
@sadjow sadjow changed the title feat: forward first Ctrl-C to managed processes in TUI feat: keep native TUI running after the first Ctrl-C Mar 12, 2026
@sadjow sadjow changed the title feat: keep native TUI running after the first Ctrl-C feat: show a quit prompt on first Ctrl-C in native TUI Mar 12, 2026
@sadjow

sadjow commented Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

Potential follow-up after this lands: the first Ctrl-C prompt could grow additional actions beyond c/q, for example lightweight process info, diagnostics, or selected-process controls. I think it makes sense to keep this PR scoped to the prompt-only behavior and revisit those extra options separately once the base interaction settles.

@sadjow sadjow marked this pull request as ready for review March 12, 2026 02:13
@sadjow

sadjow commented Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

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.

@domenkozar

Copy link
Copy Markdown
Member

What's the motivation for prompting after ctrl-c?

@sadjow

sadjow commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

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

image

I'm also missing this feature from the previous default process manager: process compose that also prompts about exiting.

image

@sadjow

sadjow commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

@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.

@domenkozar domenkozar merged commit bb972a2 into cachix:main Mar 16, 2026
17 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants