Repository navigation
feat(web): add configurable picker navigation keybindings #7164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
62e5a7b
b39bdcf
cfd9c72
0d16678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,11 @@ import { | |
| import { isCommandPaletteOpen } from "../../commandPaletteBus"; | ||
| import { getTerminalFocusOwner } from "../../lib/terminalFocus"; | ||
| import type { AssistantCitationSourceAnchor } from "~/lib/assistantTextSelection"; | ||
| import { resolveShortcutCommand, shortcutLabelForCommand } from "../../keybindings"; | ||
| import { | ||
| pickerNavigationKeyForEvent, | ||
| resolveShortcutCommand, | ||
| shortcutLabelForCommand, | ||
| } from "../../keybindings"; | ||
| import { | ||
| type TerminalContextDraft, | ||
| type TerminalContextSelection, | ||
|
|
@@ -1366,6 +1370,7 @@ export interface ChatComposerProps { | |
| settings: UnifiedSettings; | ||
| keybindings: ResolvedKeybindingsConfig; | ||
| terminalOpen: boolean; | ||
| previewOpen: boolean; | ||
| gitCwd: string | null; | ||
| pullRequestProjectId: ProjectId | null; | ||
| pullRequestRepository: string | null; | ||
|
|
@@ -1484,6 +1489,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) | |
| settings, | ||
| keybindings, | ||
| terminalOpen, | ||
| previewOpen, | ||
| gitCwd, | ||
| pullRequestProjectId, | ||
| pullRequestRepository, | ||
|
|
@@ -3963,6 +3969,22 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) | |
| } | ||
| return false; | ||
| }; | ||
| const resolveComposerPickerNavigationKey = useCallback( | ||
| (event: KeyboardEvent) => { | ||
| if (!composerMenuOpenRef.current) return null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Do not resolve picker navigation while an approval hides the menu. If a draft already has a composer trigger, Add Proposed fix- if (!composerMenuOpenRef.current) return null;
+ if (!composerMenuOpenRef.current || isComposerApprovalState) return null;🤖 Prompt for AI Agents |
||
| return pickerNavigationKeyForEvent(event, keybindings, { | ||
| context: { | ||
| terminalFocus: false, | ||
| terminalOpen, | ||
| previewFocus: false, | ||
| previewOpen, | ||
| modelPickerOpen: false, | ||
| pickerFocus: true, | ||
| }, | ||
| }); | ||
| }, | ||
| [keybindings, previewOpen, terminalOpen], | ||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Picker focus skipped by global shortcutsMedium Severity
Additional Locations (2)Reviewed by Cursor Bugbot for commit 6381b31f93dfdfafd934707e684abe7c55230e21. Configure here. |
||
|
|
||
| // ------------------------------------------------------------------ | ||
| // Prompt stash (⌘S) | ||
|
|
@@ -5962,6 +5984,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) | |
| }} | ||
| className="mx-auto w-full min-w-0 max-w-3xl" | ||
| data-chat-composer-form="true" | ||
| data-keybinding-picker-focus={composerMenuOpen || undefined} | ||
| > | ||
| {composerControlsInStrip && restingControlsHost | ||
| ? createPortal( | ||
|
|
@@ -6681,6 +6704,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) | |
| onChange={onPromptChange} | ||
| onVisibleSelectionChange={expandComposerForEditorChange} | ||
| onCommandKeyDown={onComposerCommandKey} | ||
| resolvePickerNavigationKey={resolveComposerPickerNavigationKey} | ||
| onPageScrollKeyDown={onPageScrollKeyDown} | ||
| onPageScrollKeyUp={onPageScrollKeyUp} | ||
| onPageScrollRelease={onPageScrollRelease} | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve text input for configurable picker bindings.
KeybindingRuleandcompileResolvedKeybindingRuleallow a bare printable key with no modifiers. A matching event can resolve topicker.previousorpicker.next.CommandPaletteContentthen callspreventDefault()and redispatches an arrow event, so the input loses the typed character. Skip picker shortcut handling for text-producing events.🤖 Prompt for AI Agents