mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 17:32:18 +00:00
fix(terminal): respect Option-as-Meta during block selection
This commit is contained in:
1 parent
308df815d8
commit
21880ef1ea
3 files changed
+74
-26
No files matched your search
@@ -6,7 +6,7 @@ const test = require("node:test");
|
||||
const {
|
||||
PATCHES,
|
||||
patchXtermSource,
|
||||
sameLengthTrueExpression,
|
||||
sameLengthExpression,
|
||||
} = require("./patch-xterm-macos-column-selection.cjs");
|
||||
|
||||
test("patches both distributed bundles without shifting source-map offsets", () => {
|
||||
@@ -17,7 +17,7 @@ test("patches both distributed bundles without shifting source-map offsets", ()
|
||||
assert.equal(result.source.length, input.length);
|
||||
assert.equal(result.source.includes(patch.original), false);
|
||||
assert.equal(
|
||||
result.source.includes(sameLengthTrueExpression(patch.original.length)),
|
||||
result.source.includes(sameLengthExpression(patch.replacement, patch.original.length)),
|
||||
true,
|
||||
);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ test("patches readable xterm sources and source-map content", () => {
|
||||
test("is idempotent and fails closed on an unknown package shape", () => {
|
||||
for (const patch of PATCHES) {
|
||||
const replacement = patch.preserveLength
|
||||
? sameLengthTrueExpression(patch.original.length)
|
||||
? sameLengthExpression(patch.replacement, patch.original.length)
|
||||
: patch.replacement;
|
||||
assert.deepEqual(patchXtermSource(`before:${replacement}:after`, patch), {
|
||||
source: `before:${replacement}:after`,
|
||||
@@ -46,3 +46,10 @@ test("is idempotent and fails closed on an unknown package shape", () => {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("fails closed when a generated-bundle replacement would shift offsets", () => {
|
||||
assert.throws(
|
||||
() => sameLengthExpression("replacement is longer", 4),
|
||||
/replacement expression is too long/,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user