Skip to content

Commit f24eb5c

Browse files
committed
tui/tabbar: Prevent closing the last remaining tab
Ignore close tab key (Ctrl+W) when only one tab remains open. This prevents accidentally closing the entire application and preserves muscle memory for users who expect Ctrl+W to delete the last word in single-tab scenarios. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent 2cceb97 commit f24eb5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/tui/components/tabbar/tabbar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (t *TabBar) Update(msg tea.Msg) tea.Cmd {
219219
return core.CmdHandler(messages.SwitchTabMsg{SessionID: t.tabs[prevIdx].SessionID})
220220

221221
case key.Matches(msg, t.keyMap.CloseTab):
222-
if len(t.tabs) == 0 {
222+
if len(t.tabs) <= 1 {
223223
return nil
224224
}
225225
return core.CmdHandler(messages.CloseTabMsg{SessionID: t.tabs[t.activeIdx].SessionID})

0 commit comments

Comments
 (0)