[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
This commit is contained in:
74
components/terminal/runtime/optionYankLastArg.test.ts
Normal file
74
components/terminal/runtime/optionYankLastArg.test.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import { optionYankLastArgSequence } from "./optionYankLastArg";
|
||||
|
||||
// Issue #2364: Esc+. / Alt+. is readline yank-last-arg (zsh insert-last-word).
|
||||
// Traditional terminals just pass Meta-. through. On macOS, Option+. types "≥"
|
||||
// unless Option is Meta, so map the physical period / underscore keys to ESC+.
|
||||
// / ESC+_ — same idea as Option+←/→ word-jump, but always-on because ≥ is
|
||||
// almost never wanted in a terminal.
|
||||
|
||||
const ev = (over: Partial<Parameters<typeof optionYankLastArgSequence>[0]> = {}) => ({
|
||||
key: ".",
|
||||
code: "Period",
|
||||
altKey: true,
|
||||
ctrlKey: false,
|
||||
metaKey: false,
|
||||
shiftKey: false,
|
||||
...over,
|
||||
});
|
||||
|
||||
test("Option+. → ESC+. (yank-last-arg) on macOS", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev(), true), "\x1b.");
|
||||
});
|
||||
|
||||
test("Option+. with composed ≥ (US layout) still maps to ESC+.", () => {
|
||||
assert.equal(
|
||||
optionYankLastArgSequence(ev({ key: "≥", code: "Period" }), true),
|
||||
"\x1b.",
|
||||
);
|
||||
});
|
||||
|
||||
test("Option+_ → ESC+_ (yank-last-arg synonym) on macOS", () => {
|
||||
assert.equal(
|
||||
optionYankLastArgSequence(ev({ key: "_", code: "Minus", shiftKey: true }), true),
|
||||
"\x1b_",
|
||||
);
|
||||
});
|
||||
|
||||
test("not macOS → null (Linux/Windows Alt+. already sends Meta via xterm)", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev(), false), null);
|
||||
assert.equal(
|
||||
optionYankLastArgSequence(ev({ key: "_", code: "Minus", shiftKey: true }), false),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test("no Option held → null", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev({ altKey: false }), true), null);
|
||||
});
|
||||
|
||||
test("Ctrl/Cmd with Option → null (don't hijack other chords)", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev({ ctrlKey: true }), true), null);
|
||||
assert.equal(optionYankLastArgSequence(ev({ metaKey: true }), true), null);
|
||||
});
|
||||
|
||||
test("Option+Shift+. (>) → null", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev({ shiftKey: true }), true), null);
|
||||
});
|
||||
|
||||
test("other Option keys → null", () => {
|
||||
assert.equal(optionYankLastArgSequence(ev({ key: "f", code: "KeyF" }), true), null);
|
||||
assert.equal(optionYankLastArgSequence(ev({ key: "ArrowLeft", code: "ArrowLeft" }), true), null);
|
||||
});
|
||||
|
||||
test("runtime sends Option+. after kitty mode, same as word-jump", () => {
|
||||
const source = readFileSync(new URL("./createXTermRuntime.ts", import.meta.url), "utf8");
|
||||
assert.match(source, /from "\.\/optionYankLastArg"/);
|
||||
assert.match(
|
||||
source,
|
||||
/optionArrowWordJumpSequence\([\s\S]*?const yankLastArgSequence = isKittyKeyboardModeActive\(kittyKeyboardMode\)\s*\? null\s*: optionYankLastArgSequence\(/s,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user