From e3a8c59613fa3c0e4bc06194a6d85f3247818192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20He=CC=81ritier?= Date: Sun, 15 Feb 2026 19:25:46 +0100 Subject: [PATCH] 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 --- pkg/tui/dialog/session_browser.go | 4 ++-- pkg/tui/dialog/session_browser_test.go | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/tui/dialog/session_browser.go b/pkg/tui/dialog/session_browser.go index 29cf95e27..eecd0d0f4 100644 --- a/pkg/tui/dialog/session_browser.go +++ b/pkg/tui/dialog/session_browser.go @@ -76,7 +76,7 @@ func NewSessionBrowserDialog(sessions []session.Summary) Dialog { Escape: key.NewBinding(key.WithKeys("esc")), Star: key.NewBinding(key.WithKeys("ctrl+s")), FilterStar: key.NewBinding(key.WithKeys("ctrl+f")), - CopyID: key.NewBinding(key.WithKeys("ctrl+k")), + CopyID: key.NewBinding(key.WithKeys("ctrl+y")), }, openedAt: time.Now(), } @@ -290,7 +290,7 @@ func (d *sessionBrowserDialog) View() string { AddSeparator(). AddContent(idFooter). AddSpace(). - AddHelpKeys("↑/↓", "navigate", "ctrl+s", "star", "ctrl+f", filterDesc, "ctrl+k", "copy id", "enter", "load", "esc", "close"). + AddHelpKeys("↑/↓", "navigate", "ctrl+s", "star", "ctrl+f", filterDesc, "ctrl+y", "copy id", "enter", "load", "esc", "close"). Build() return styles.DialogStyle.Width(dialogWidth).Render(content) diff --git a/pkg/tui/dialog/session_browser_test.go b/pkg/tui/dialog/session_browser_test.go index fd82a720c..b2fdaed24 100644 --- a/pkg/tui/dialog/session_browser_test.go +++ b/pkg/tui/dialog/session_browser_test.go @@ -87,6 +87,12 @@ func TestSessionBrowserNavigationWithCtrl(t *testing.T) { updated, _ = d.Update(ctrlK) d = updated.(*sessionBrowserDialog) require.Equal(t, 0, d.selected, "selection should be 0 after ctrl+k") + + // Verify ctrl+y is bound to CopyID and doesn't collide with Up. + // We only assert key matching here to avoid clipboard side-effects in tests. + ctrlY := tea.KeyPressMsg{Code: 'y', Mod: tea.ModCtrl} + require.True(t, key.Matches(ctrlY, d.keyMap.CopyID), "ctrl+y should match keyMap.CopyID") + require.False(t, key.Matches(ctrlY, d.keyMap.Up), "ctrl+y should not match keyMap.Up") } func TestSessionBrowserViewShowsSelection(t *testing.T) {