Skip to content

Commit 46cf865

Browse files
authored
feat: terminal text selection and copy/paste functionality
* feat: terminal text selection and copy/paste functionality - Add clipboard IPC handlers for readText/writeText operations - Create useTerminalClipboard hook with selection state management - Implement keyboard shortcuts: Ctrl/Cmd+C (copy), Ctrl/Cmd+V (paste), Ctrl/Cmd+A (select all) - Add Radix UI context menu with Copy, Paste, Select All options - Add rate limiting (100ms) for clipboard operations - Add input validation and 10MB size limits for clipboard content - Add accessibility labels and keyboard shortcut indicators - Update terminal config with selection colors and screenReaderMode - Add comprehensive test coverage (32 new tests) Fixes: - Register clipboard IPC in main process - Fix context menu trigger for proper right-click behavior - Fix stale closure issues in useTerminalClipboard hook - Fix race conditions in async clipboard operations Closes: terminal text selection and copy/paste feature * fix: prevent double paste when using Ctrl+V keyboard shortcut - Add isPastingRef guard to prevent concurrent paste operations - Add event.preventDefault() to stop browser default paste behavior - Add 100ms cooldown after paste to prevent rapid successive calls - Fix duplicate import in use-terminal-clipboard.ts Fixes issue where Ctrl+V would paste text multiple times while context menu paste worked correctly. * fix: use Buffer.byteLength for accurate clipboard size validation Change text length validation from text.length (UTF-16 code units) to Buffer.byteLength(text, 'utf8') to properly measure actual bytes. This ensures multibyte characters (emoji, CJK) are correctly counted towards the MAX_CLIPBOARD_SIZE limit.
1 parent b6c1a59 commit 46cf865

File tree

13 files changed

+12961
-7
lines changed

13 files changed

+12961
-7
lines changed

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)