Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions pkg/tui/components/tabbar/tabbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ func New(maxTitleLen int) *TabBar {
}
}

// SetCloseTabEnabled enables or disables the close-tab key binding.
// When disabled, Ctrl+W passes through to the editor for word deletion.
func (t *TabBar) SetCloseTabEnabled(v bool) {
t.keyMap.CloseTab.SetEnabled(v)
}

// SetWidth sets the available width for the tab bar.
func (t *TabBar) SetWidth(width int) {
t.width = width
Expand Down
3 changes: 3 additions & 0 deletions pkg/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,10 @@ func (m *appModel) handleKeyPress(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {

// Tab bar keys (Ctrl+t, Ctrl+p, Ctrl+n, Ctrl+w) are suppressed during
// history search so that ctrl+n/ctrl+p cycle through matches instead.
// Ctrl+w (close tab) is disabled when the editor is focused so that the
// standard "delete word" shortcut works while typing.
if !m.leanMode && !m.editor.IsHistorySearchActive() {
m.tabBar.SetCloseTabEnabled(m.focusedPanel != PanelEditor)
if cmd := m.tabBar.Update(msg); cmd != nil {
return m, cmd
}
Expand Down
Loading