Skip to content

Commit e3a8c59

Browse files
committed
fix(#1741): resolve Ctrl+K key binding conflict in session browser
Ctrl+K was bound to both Up navigation and CopyID in the session browser dialog. Since Up was matched first in the Update switch, the CopyID handler was unreachable. Reassign CopyID to Ctrl+Y (vim/emacs yank convention), keeping Ctrl+K for Up navigation consistent with the command palette. Assisted-By: cagent
1 parent d8f01f7 commit e3a8c59

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

pkg/tui/dialog/session_browser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func NewSessionBrowserDialog(sessions []session.Summary) Dialog {
7676
Escape: key.NewBinding(key.WithKeys("esc")),
7777
Star: key.NewBinding(key.WithKeys("ctrl+s")),
7878
FilterStar: key.NewBinding(key.WithKeys("ctrl+f")),
79-
CopyID: key.NewBinding(key.WithKeys("ctrl+k")),
79+
CopyID: key.NewBinding(key.WithKeys("ctrl+y")),
8080
},
8181
openedAt: time.Now(),
8282
}
@@ -290,7 +290,7 @@ func (d *sessionBrowserDialog) View() string {
290290
AddSeparator().
291291
AddContent(idFooter).
292292
AddSpace().
293-
AddHelpKeys("↑/↓", "navigate", "ctrl+s", "star", "ctrl+f", filterDesc, "ctrl+k", "copy id", "enter", "load", "esc", "close").
293+
AddHelpKeys("↑/↓", "navigate", "ctrl+s", "star", "ctrl+f", filterDesc, "ctrl+y", "copy id", "enter", "load", "esc", "close").
294294
Build()
295295

296296
return styles.DialogStyle.Width(dialogWidth).Render(content)

pkg/tui/dialog/session_browser_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ func TestSessionBrowserNavigationWithCtrl(t *testing.T) {
8787
updated, _ = d.Update(ctrlK)
8888
d = updated.(*sessionBrowserDialog)
8989
require.Equal(t, 0, d.selected, "selection should be 0 after ctrl+k")
90+
91+
// Verify ctrl+y is bound to CopyID and doesn't collide with Up.
92+
// We only assert key matching here to avoid clipboard side-effects in tests.
93+
ctrlY := tea.KeyPressMsg{Code: 'y', Mod: tea.ModCtrl}
94+
require.True(t, key.Matches(ctrlY, d.keyMap.CopyID), "ctrl+y should match keyMap.CopyID")
95+
require.False(t, key.Matches(ctrlY, d.keyMap.Up), "ctrl+y should not match keyMap.Up")
9096
}
9197

9298
func TestSessionBrowserViewShowsSelection(t *testing.T) {

0 commit comments

Comments
 (0)