[Bug] Ctrl+Q does not quit the TUI: action_quit override drops the async super() coroutine
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
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fderuiter/sortify
-
bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
architecture enhancement ready-for-agent
Difficulty 5/5 Over a week Newbie friendliness 35/100
fderuiter/sortify#783 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement ready-for-human
Difficulty 4/5 3-5 days Newbie friendliness 48/100
fderuiter/sortify#740 · 1 comment ·
Maintainers usually reply within 1 day
-
architecture enhancement ready-for-human
Difficulty 5/5 Over a week Newbie friendliness 25/100
fderuiter/sortify#726 · 1 comment ·
Maintainers usually reply within 1 day
-
architecture enhancement ready-for-human
Difficulty 5/5 Over a week Newbie friendliness 25/100
fderuiter/sortify#723 · 1 comment ·
Maintainers usually reply within 1 day
All issues in fderuiter/sortify
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
good first issue module-baseline needs triage ux
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
darnitdevorg/darnit#650 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nyjc-computing/campus#938 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nf-osi/nf-metadata-dictionary#1027 ·
Maintainers usually reply within 1 day
-
bug documentation
Difficulty 1/5 Under an hour Newbie friendliness 92/100
qatrackplus/qatrackplus#913 ·
Maintainers usually reply within 3 days