feat(ui): add Ctrl/Cmd+L to send selected text to chat

Bind mod+l to append the current selection into the chat composer
(Cursor-style), and move session sidebar toggle to mod+alt+l so desktop
menus stay in sync. Closes #208.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-03 12:04:35 +00:00
co-authored by Serhii Dziupin
parent e0bd787468
commit 3ad3f21024
30 changed files with 362 additions and 5 deletions
@@ -16,6 +16,7 @@ import { useDirectoryStore } from '@/stores/useDirectoryStore';
import { useProjectsStore } from '@/stores/useProjectsStore';
import { getCycledPrimaryAgentName } from '@/components/chat/mobileControlsUtils';
import { focusChatInput } from '@/components/chat/composer/editor/dom';
import { addSelectionToChat } from '@/lib/addSelectionToChat';
import { hasOpenDropdown } from './keyboard-shortcut-dom';
export const useKeyboardShortcuts = () => {
@@ -337,6 +338,12 @@ export const useKeyboardShortcuts = () => {
return;
}
if (eventMatchesShortcut(e, combo('add_selection_to_chat'))) {
e.preventDefault();
addSelectionToChat();
return;
}
if (eventMatchesShortcut(e, combo('toggle_sidebar'))) {
e.preventDefault();
const { isMobile, isSessionSwitcherOpen } = useUIStore.getState();
+6
View File
@@ -10,6 +10,7 @@ import { useThemeSystem } from '@/contexts/useThemeSystem';
import { sessionEvents } from '@/lib/sessionEvents';
import { createWorktreeSession } from '@/lib/worktreeSessionCreator';
import { showOpenCodeStatus } from '@/lib/openCodeStatus';
import { addSelectionToChat } from '@/lib/addSelectionToChat';
const getActiveElementSelectedText = (): string => {
if (typeof document === 'undefined') {
@@ -77,6 +78,7 @@ type MenuAction =
| 'toggle-terminal'
| 'toggle-terminal-expanded'
| 'copy'
| 'add-selection-to-chat'
| 'theme-light'
| 'theme-dark'
| 'theme-system'
@@ -278,6 +280,10 @@ export const useMenuActions = (
setThemeMode('system');
break;
case 'add-selection-to-chat':
addSelectionToChat();
break;
case 'toggle-sidebar':
toggleSidebar();
break;