| ... | ... | @@ -321,7 +321,11 @@ export function isTerminalCopyShortcut( |
| 321 | 321 | event: Pick<KeyboardEvent, "ctrlKey" | "key" | "metaKey" | "shiftKey">, |
| 322 | 322 | platform = navigator.platform, |
| 323 | 323 | ) { |
| 324 | | if (event.key.toLowerCase() !== "c") return false; |
| 324 | const key = event.key.toLowerCase(); |
| 325 | if (key === "insert" && !isMacPlatform(platform)) { |
| 326 | return event.ctrlKey && !event.shiftKey && !event.metaKey; |
| 327 | } |
| 328 | if (key !== "c") return false; |
| 325 | 329 | return isMacPlatform(platform) ? event.metaKey : event.ctrlKey; |
| 326 | 330 | } |
| 327 | 331 | |
| ... | ... | @@ -1027,12 +1031,12 @@ export class GhosttyTerminalSurface { |
| 1027 | 1031 | // A plain Ctrl+C/Cmd+C fires the browser's native copy event, caught in |
| 1028 | 1032 | // onCopyEvent; not preventing the default keeps that path alive. WebKit |
| 1029 | 1033 | // omits the keyboard copy event without a DOM selection, so race the |
| 1030 | | // clipboard write against it the same way paste races its read. The |
| 1031 | | // Shift variant has no native event (Chrome binds Ctrl+Shift+C to |
| 1034 | // clipboard write against it the same way paste races its read. Ctrl+Shift+C |
| 1035 | // and Ctrl+Insert have no native copy event (Chrome binds the former to |
| 1032 | 1036 | // inspect), so synthesize one with execCommand("copy"). |
| 1033 | 1037 | const selection = this.getSelection(); |
| 1034 | 1038 | this.primeCopy(selection); |
| 1035 | | if (event.shiftKey) { |
| 1039 | if (event.shiftKey || event.key.toLowerCase() === "insert") { |
| 1036 | 1040 | event.preventDefault(); |
| 1037 | 1041 | document.execCommand("copy"); |
| 1038 | 1042 | } else { |