mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
* fix(#2453): automated Cursor CLI fix * fix(terminal): guard ConPTY clear behind viewport clear * fix(terminal): enable effective ConPTY buffer clear --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
test("clearBuffer uses the guarded viewport and ConPTY sync helper", () => {
|
|
const runtimeSource = readFileSync(new URL("./createXTermRuntime.ts", import.meta.url), "utf8");
|
|
const clearCaseIndex = runtimeSource.indexOf('case "clearBuffer"');
|
|
assert.notEqual(clearCaseIndex, -1);
|
|
|
|
const clearCase = runtimeSource.slice(clearCaseIndex, clearCaseIndex + 500);
|
|
assert.match(clearCase, /clearTerminalViewportAndSyncPty\(term,/);
|
|
assert.match(clearCase, /clearSessionPtyBuffer\?\.\(clearId\)/);
|
|
});
|
|
|
|
test("context-menu clear also uses the guarded viewport and ConPTY sync helper", () => {
|
|
const actionsSource = readFileSync(
|
|
new URL("../hooks/useTerminalContextActions.ts", import.meta.url),
|
|
"utf8",
|
|
);
|
|
const onClearIndex = actionsSource.indexOf("const onClear = useCallback");
|
|
assert.notEqual(onClearIndex, -1);
|
|
const onClear = actionsSource.slice(onClearIndex, onClearIndex + 650);
|
|
assert.match(onClear, /clearTerminalViewportAndSyncPty\(term,/);
|
|
assert.match(onClear, /clearSessionPtyBuffer\?\.\(id\)/);
|
|
});
|