Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] Ctrl+Q does not quit the TUI: action_quit override drops the async super() coroutine

Closed Beginner friendly
#731 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #747 by @fderuiter — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli, desktop, testing

Research direction

Start with app/ui/tui.py around action_quit and the Ctrl+Q binding; the issue includes a reproduction and identifies Textual's async quit action. Add or update a pilot test that presses Ctrl+Q when a tree has focus and checks that the app exits, while preserving the text-input focus behavior. Done means the test passes without the unawaited-coroutine warning.

Written by the indexing model from the issue text.

Description

bug

Summary

AutoSorterTUI.action_quit is a synchronous override of Textual's async App.action_quit. It calls super().action_quit() without awaiting it, so the coroutine is created and thrown away, and self.exit() never runs. The Ctrl+Q binding (and anything else that dispatches quit) does nothing except emit a RuntimeWarning.

Location

  • app/ui/tui.py:8338-8342
def action_quit(self) -> None:
    if self._is_text_control_focused():
        return
    super().action_quit()   # coroutine never awaited
  • Binding: app/ui/tui.py:6197, Binding("ctrl+q", "quit", "Quit", show=True)
  • Textual 8.2.8: async def action_quit(self) -> None: self.exit()

Evidence / reproduction

A pilot script (pilot.press("ctrl+q") with focus on the tree):

app/ui/tui.py:8342: RuntimeWarning: coroutine 'App.action_quit' was never awaited
  super().action_quit()
focused: VimTree
after ctrl+q is_running: True return_code: None

mypy reports it too, but the error is hidden because app.ui.* has ignore_errors = true:

app/ui/tui.py:8338: error: Return type "None" of "action_quit" incompatible with return type "Coroutine[Any, Any, None]" in supertype "textual.app.App"  [override]
app/ui/tui.py:8342: error: Value of type "Coroutine[Any, Any, None]" must be used  [unused-coroutine]

No test covers quitting. A grep for action_quit or ctrl+q in tests/ finds nothing.

Expected vs actual

  • Expected: Ctrl+Q exits the app unless a text input has focus.
  • Actual: the app keeps running, and users must kill the terminal.

Suggested fix

async def action_quit(self) -> None:
    if self._is_text_control_focused():
        return
    await super().action_quit()   # or simply self.exit()

Add a pilot test that presses ctrl+q and asserts that app.return_code is set or that run_test exits.

Severity

medium

Dominant language
Python
Stars
1
Forks
0
Avg merge
10h 10m
Merged PRs (30d)
420

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fderuiter/sortify

All issues in fderuiter/sortify

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.