aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/actions.rs
diff options
context:
space:
mode:
authorEric Yue <jiacheng.yue@foxmail.com>2026-09-21 01:33:11 +0800
committerGitHub <noreply@github.com>2026-09-20 19:33:11 +0200
commitf090ce95d05d2e7811869be93f9a23bf4ac2c3af (patch)
treed5a1a447fd6043056e5ea3cb1a9bd0419957e57b /src/client/shell/actions.rs
parentf10df75c8a5f1b5e5f90689c3a8ceb6758366e05 (diff)
fix: confirm closing the last tab in the tui (#4409)
* fix: confirm closing the last tab in the tui refs #4379 * docs: clarify last-tab worktree confirmation in translations refs #4379 --------- Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/client/shell/actions.rs')
-rw-r--r--src/client/shell/actions.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/shell/actions.rs b/src/client/shell/actions.rs
index da4edd49..9d0a3bd5 100644
--- a/src/client/shell/actions.rs
+++ b/src/client/shell/actions.rs
@@ -124,6 +124,16 @@ impl ClientShellState {
outcome.repaint = true;
return;
}
+ if action == crate::input::KeybindAction::CloseTab {
+ if let Some(tab_id) = self
+ .snapshot
+ .as_deref()
+ .and_then(|snapshot| snapshot.focused_tab_id.clone())
+ {
+ self.request_tab_close(tab_id, outcome);
+ }
+ return;
+ }
if action == crate::input::KeybindAction::NewTab && self.config.prompt_new_tab_name
{
self.open_new_tab_overlay();
@@ -1040,9 +1050,6 @@ impl ClientShellState {
env: Default::default(),
}))
}
- KeybindAction::CloseTab => Some(Method::TabClose(TabTarget {
- tab_id: focused_tab?,
- })),
KeybindAction::ClosePane => Some(Method::PaneClose(PaneTarget {
pane_id: focused_pane.clone()?,
})),