Skip to content

Fix Quit action being silently dropped (#892)#1614

Open
nikicat wants to merge 3 commits into
raphamorim:mainfrom
nikicat:fix/quit-action-dropped-event
Open

Fix Quit action being silently dropped (#892)#1614
nikicat wants to merge 3 commits into
raphamorim:mainfrom
nikicat:fix/quit-action-dropped-event

Conversation

@nikicat
Copy link
Copy Markdown

@nikicat nikicat commented May 29, 2026

Summary

The Quit action does nothing on Linux/Windows: keyboard binds and the command palette both call ContextManager::quit(), which emits RioEvent::Quit — but application.rs only has a handler for RioEvent::Exit, so the event falls through and is silently dropped. (macOS is unaffected because it quits via the applicationShouldTerminate path.)

The two events are redundant halves of the same intent:

  • RioEvent::Quit — sent (context/mod.rs:673) but never handled
  • RioEvent::Exit — handled (application.rs:422, with the confirm_before_quit logic) but never sent

This consolidates them: the handler now matches RioEvent::Quit (consistent with Action::Quit, PaletteAction::Quit, ContextManager::quit, Route::quit), and the dead RioEvent::Exit variant is removed. The existing handler already respects confirm_before_quit and otherwise exits, so no behavior is lost.

Fixes #892.

Test plan

  • cargo check -p rioterm -p rio-backend passes with no new warnings
  • Confirmed on Linux (Arch/Wayland/GNOME): a custom [bindings] Quit entry now quits Rio
  • macOS Cmd+Q still quits (unchanged path)
  • Windows quit binding works

Note: Action::Quit only ships in the macOS default bindings, so Linux/Windows users still need a custom bind or the command palette to trigger it — but those paths now work. Adding a cross-platform default keybind is left as a separate decision.

🤖 Generated with Claude Code

nikicat and others added 3 commits May 29, 2026 18:05
ContextManager::quit() emitted RioEvent::Quit, but application.rs only
handled RioEvent::Exit, so the Quit binding and command-palette entry
were silently dropped on Linux/Windows (macOS quits via a separate
path). The two events were redundant: Quit was sent-but-never-handled,
Exit handled-but-never-sent.

Point the handler at RioEvent::Quit and remove the now-dead
RioEvent::Exit variant.

Fixes raphamorim#892

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The confirm dialog is an overlay drawn outside the terminal's damage
tracking. While in ConfirmQuit the app runs a continuous redraw loop,
but screen.render() discards any frame where no panel is dirty, dropping
the overlay on idle frames. The dialog only appeared when the terminal
happened to be dirty (recent output, cursor blink), so it showed
intermittently.

Mark the panel dirty after drawing the dialog so the frame is always
presented.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 511f935)
Pressing N or Escape set the route back to Terminal but never requested
a redraw, so the stale dialog overlay stayed on screen until the next
event (any keypress) triggered a repaint. Request an overlay redraw so
the terminal repaints immediately, matching the other dismiss paths in
has_key_wait.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 19cf541)
@nikicat
Copy link
Copy Markdown
Author

nikicat commented May 30, 2026

Pushed two follow-up commits that fix the quit-confirmation dialog (the overlay shown when confirm_before_quit is on), which surface now that the Quit action actually fires:

  • fix: always present the quit-confirmation dialog — the confirm dialog is an overlay drawn outside the terminal's damage tracking. While in ConfirmQuit the app runs a continuous redraw loop, but screen.render() discards any frame where no panel is dirty, so the overlay only appeared when the terminal happened to be dirty (recent output, cursor blink) and otherwise flickered/was dropped on idle frames. Mark the panel dirty after drawing the dialog so the frame is always presented.
  • fix: repaint when dismissing the quit-confirmation dialog — pressing N/Esc set the route back to Terminal but never requested a redraw, so the stale dialog overlay stayed on screen until the next event. Request an overlay redraw to repaint immediately, matching the other dismiss paths.

Happy to split these into a separate PR if you'd prefer to keep this one to just the event-dispatch fix.

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.

Cannot quit via key binds

1 participant