@cplieger/web-terminal-engine 6.4.0-dev.8 → 6.4.0-dev.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplieger/web-terminal-engine",
3
- "version": "6.4.0-dev.8",
3
+ "version": "6.4.0-dev.9",
4
4
  "license": "MPL-2.0",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cplieger/web-terminal-engine",
3
- "version": "6.4.0-dev.8",
3
+ "version": "6.4.0-dev.9",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "typecheck": "tsc -p tsconfig.json",
@@ -22,8 +22,8 @@
22
22
  "@stryker-mutator/vitest-runner": "10.0.0",
23
23
  "@types/pngjs": "6.0.5",
24
24
  "@typescript/native": "npm:typescript@7.0.2",
25
- "@vitest/browser-playwright": "5.0.4",
26
- "@vitest/coverage-v8": "5.0.4",
25
+ "@vitest/browser-playwright": "5.0.5",
26
+ "@vitest/coverage-v8": "5.0.5",
27
27
  "esbuild": "0.28.2",
28
28
  "eslint": "10.12.0",
29
29
  "fast-check": "4.10.2",
@@ -33,7 +33,7 @@
33
33
  "prettier": "3.9.10",
34
34
  "typescript": "npm:@typescript/typescript6@6.0.2",
35
35
  "typescript-eslint": "8.71.2",
36
- "vitest": "5.0.4"
36
+ "vitest": "5.0.5"
37
37
  },
38
38
  "overrides": {
39
39
  "qs": "^6.15.2"
package/src/keyboard.ts CHANGED
@@ -339,10 +339,10 @@ function anyModifier(ev: KeyboardEvent): boolean {
339
339
  }
340
340
 
341
341
  /**
342
- * The kitty "unicode-key-code": the UNSHIFTED (lower-case / base-layout)
343
- * codepoint of the key. Letters and digits are read from ev.code (the physical
344
- * key), so a composed Alt/Option character on macOS still maps to its base key;
345
- * other single-character keys fall back to the case-folded ev.key.
342
+ * The kitty "unicode-key-code", read as the UNSHIFTED US-layout codepoint of
343
+ * the physical key: letters, digits and KITTY_CODE_BASE's punctuation come from
344
+ * ev.code, so a composed Option character or a shifted symbol maps to its base
345
+ * key; any other single-character key falls back to the case-folded ev.key.
346
346
  */
347
347
  function kittyKeyCodepoint(ev: KeyboardEvent): number {
348
348
  const code = ev.code;
@@ -431,6 +431,12 @@ function encodeKittyDisambiguate(ev: KeyboardEvent): KeyboardResult {
431
431
  if (ev.metaKey && !ev.ctrlKey && !ev.altKey) {
432
432
  return { kind: "ignore" };
433
433
  }
434
+ // A desktop AltGr character arrives with ctrlKey and altKey clear, so it stays
435
+ // text: on Windows, Chromium and Firefox swap Ctrl+Alt for AltGraph whenever
436
+ // the chord types a character (https://chromestatus.com/feature/5059438092222464,
437
+ // https://searchfox.org/mozilla-central/source/widget/windows/KeyboardLayout.cpp).
438
+ // AltGraph must not exempt a key here: Firefox sets it on every macOS Option
439
+ // chord (widget/cocoa/nsCocoaUtils.mm), and Ctrl+Option+a is 97;7u.
434
440
  if (ev.ctrlKey || ev.altKey || ev.metaKey) {
435
441
  const cp = kittyKeyCodepoint(ev);
436
442
  if (cp > 0) {
@@ -480,15 +486,6 @@ export function mapKeyboardEvent(ev: KeyboardEvent, modes: KeyboardModes): Keybo
480
486
  }
481
487
  }
482
488
 
483
- // Browser-reserved meta combos (Cmd+R, Cmd+T, Cmd+Q, Cmd+W on Mac;
484
- // Ctrl+R, Ctrl+T, Ctrl+W with no Shift on others). Let the browser
485
- // handle them. Heuristic: only take Ctrl+letter when Shift is NOT
486
- // held AND the letter is one of the ones xterm consumes (a-z),
487
- // skipping the few that browsers commonly reserve.
488
- // (Ctrl+R, Ctrl+T and Ctrl+W still go to the PTY: readline binds them to
489
- // reverse search, transpose and word rubout, and full-screen programs bind
490
- // them too. On macOS, Cmd reaches the browser's own combos.)
491
-
492
489
  // Shift+PageUp / Shift+PageDown — local scrollback navigation
493
490
  // (matches xterm.js KeyboardResultType.PAGE_UP/PAGE_DOWN).
494
491
  if (ev.key === "PageUp" && ev.shiftKey && !ev.ctrlKey && !ev.altKey && !ev.metaKey) {
@@ -590,7 +587,9 @@ export function mapKeyboardEvent(ev: KeyboardEvent, modes: KeyboardModes): Keybo
590
587
  return { kind: "ignore" }; // let `input` event handle plain space
591
588
  }
592
589
 
593
- // Single printable character with modifiers.
590
+ // Single printable character with modifiers. Neither branch takes Meta, so
591
+ // the browser keeps Cmd+R/T/W/C/V; Ctrl+R/T/W go to the PTY, where readline
592
+ // binds them.
594
593
  if (ev.key.length === 1) {
595
594
  const ch = ev.key;
596
595