fix(terminal): use ctrl shift c for output copy

Capture Ctrl+Shift+C before xterm input handling and copy selected output through a browser-compatible fallback. Preserve Ctrl+C as terminal input.
This commit is contained in:
2026-07-22 13:01:31 +02:00
parent 29e765b2be
commit bcc7486b59
3 changed files with 38 additions and 25 deletions
@@ -33,25 +33,28 @@ describe("getTerminalScrollbackLimit", () => {
});
describe("shouldCopyTerminalSelection", () => {
it("copies a selected terminal region with Ctrl+C or Cmd+C", () => {
it("copies a selected terminal region with Ctrl+Shift+C", () => {
expect(
shouldCopyTerminalSelection(
{ ctrlKey: true, metaKey: false, key: "c" },
true,
),
).toBe(true);
expect(
shouldCopyTerminalSelection(
{ ctrlKey: false, metaKey: true, key: "C" },
{ ctrlKey: true, shiftKey: true, key: "c" },
true,
),
).toBe(true);
});
it("keeps Ctrl+C as a terminal interrupt without a selection", () => {
it("keeps Ctrl+C as a terminal interrupt", () => {
expect(
shouldCopyTerminalSelection(
{ ctrlKey: true, metaKey: false, key: "c" },
{ ctrlKey: true, shiftKey: false, key: "c" },
true,
),
).toBe(false);
});
it("does not copy without a selection", () => {
expect(
shouldCopyTerminalSelection(
{ ctrlKey: true, shiftKey: true, key: "c" },
false,
),
).toBe(false);