Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions wingman/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class WingmanApp(App):
Binding("ctrl+b", "background", "Background"),
Binding("ctrl+z", "undo", "Undo"),
Binding("ctrl+c", "quit", "Quit"),
Binding("ctrl+d", "exit_if_empty", "Quit", priority=True, show=False),
Binding("ctrl+q", "quit", "Quit", show=False),
Binding("f1", "help", "Help"),
# Split panel controls
Expand Down Expand Up @@ -1339,6 +1340,12 @@ def action_undo(self) -> None:
else:
self._show_info("[#f7768e]Failed to restore checkpoint[/]")

def action_exit_if_empty(self) -> None:
"""Exit the app on Ctrl+D when the active input has no text."""
focused = self.screen.focused
if isinstance(focused, Input) and not (focused.value or "").strip():
self.exit()

def action_help(self) -> None:
bg_count = len(get_background_processes())
cp_count = len(get_checkpoint_manager()._checkpoints)
Expand Down