Skip to content

fix(#1741): resolve Ctrl+K key binding conflict in session browser#1742

Merged
rumpl merged 1 commit intodocker:mainfrom
aheritier:fix/1741-session-browser-ctrl-k-conflict
Feb 16, 2026
Merged

fix(#1741): resolve Ctrl+K key binding conflict in session browser#1742
rumpl merged 1 commit intodocker:mainfrom
aheritier:fix/1741-session-browser-ctrl-k-conflict

Conversation

@aheritier
Copy link
Contributor

Summary

Fixes #1741

Ctrl+K was bound to both Up navigation and CopyID in the session browser dialog's key map. Since the Up case is checked first in the Update switch statement, the CopyID handler was unreachable — pressing Ctrl+K always moved the selection up instead of copying the session ID.

Changes

  • pkg/tui/dialog/session_browser.go: Reassigned CopyID from Ctrl+K to Ctrl+Y (vim/emacs yank convention). Ctrl+K remains bound to Up navigation, consistent with Ctrl+J/Ctrl+K in the command palette. Updated help text accordingly.
  • pkg/tui/dialog/session_browser_test.go: Updated TestSessionBrowserNavigationWithCtrl to verify Ctrl+K navigates up, and added assertions that Ctrl+Y matches CopyID and does not change selection.

Testing

  • All existing tests pass
  • go vet clean

dgageot
dgageot previously approved these changes Feb 15, 2026
@aheritier aheritier marked this pull request as ready for review February 15, 2026 20:16
@aheritier aheritier requested a review from a team as a code owner February 15, 2026 20:16
Copilot AI review requested due to automatic review settings February 15, 2026 20:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Resolves the session browser dialog’s Ctrl+K key binding conflict by moving the “Copy session ID” action off Ctrl+K so Up navigation remains reachable.

Changes:

  • Rebound CopyID from Ctrl+K to Ctrl+Y in the session browser keymap.
  • Updated the session browser ctrl-navigation test to validate Ctrl+Y matches CopyID and doesn’t move selection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/tui/dialog/session_browser.go Changes the CopyID key binding to ctrl+y to remove the ctrl+k conflict with Up.
pkg/tui/dialog/session_browser_test.go Adds assertions around ctrl+y matching CopyID and ensures selection doesn’t change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 76 to 80
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")),
},
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CopyID was rebound to ctrl+y, but the on-screen help in View() still advertises ctrl+k for "copy id" (see the AddHelpKeys(...) call). This will mislead users and also contradicts the new keymap; update the help text to match the new binding.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right — the AddHelpKeys call on line 293 was still showing ctrl+k. I had the fix locally but it was locked to another GitButler branch and didn't make it into the commit. Now fixed in 53e8d65.

Comment on lines 95 to 98

updated, _ = d.Update(ctrlY)
d = updated.(*sessionBrowserDialog)
require.Equal(t, 0, d.selected, "selection should remain 0 after ctrl+y (CopyID)")
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test calls d.Update(ctrlY), which immediately executes clipboard.WriteAll(...) in the CopyID handler. That mutates the developer/CI system clipboard during go test, which is an undesirable side effect for a unit test. Consider avoiding the Update(ctrlY) call (only assert key matching), or refactor CopyID to return a tea.Cmd that performs the clipboard write so tests don't trigger it unless they explicitly execute the command.

Suggested change
updated, _ = d.Update(ctrlY)
d = updated.(*sessionBrowserDialog)
require.Equal(t, 0, d.selected, "selection should remain 0 after ctrl+y (CopyID)")

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Removed the d.Update(ctrlY) call — the test now only asserts key matching to avoid mutating the system clipboard during go test. Amended in ebc63e3.

@aheritier aheritier force-pushed the fix/1741-session-browser-ctrl-k-conflict branch 2 times, most recently from ebc63e3 to 53e8d65 Compare February 15, 2026 20:30
@aheritier
Copy link
Contributor Author

copilot feedbacks addressed

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
@aheritier aheritier force-pushed the fix/1741-session-browser-ctrl-k-conflict branch from 53e8d65 to e3a8c59 Compare February 16, 2026 09:00
@rumpl rumpl merged commit 88b395b into docker:main Feb 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session browser: Ctrl+K key binding conflict prevents CopyID from working

3 participants