mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
84416d04bf
* Fix long paste display artifacts * Fix serial line mode pasted chunks * Narrow long paste display cleanup scope * Strip only matched paste echo highlights * Honor paste scroll setting through xterm paste
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { handleSerialLineModeInput } from "./serialLineInput";
|
|
|
|
test("serial line mode sends completed lines from a multi-line paste chunk", () => {
|
|
const writes: string[] = [];
|
|
const echoes: string[] = [];
|
|
const bufferRef = { current: "" };
|
|
|
|
handleSerialLineModeInput("show version\rshow clock", {
|
|
bufferRef,
|
|
writeToSession: (data) => writes.push(data),
|
|
writeToTerminal: (data) => echoes.push(data),
|
|
});
|
|
|
|
assert.deepEqual(writes, ["show version\r"]);
|
|
assert.equal(bufferRef.current, "show clock");
|
|
assert.deepEqual(echoes, []);
|
|
});
|
|
|
|
test("serial line mode sends every completed line when pasted text ends with enter", () => {
|
|
const writes: string[] = [];
|
|
const echoes: string[] = [];
|
|
const bufferRef = { current: "" };
|
|
|
|
handleSerialLineModeInput("show version\rshow clock\r", {
|
|
bufferRef,
|
|
localEcho: true,
|
|
writeToSession: (data) => writes.push(data),
|
|
writeToTerminal: (data) => echoes.push(data),
|
|
});
|
|
|
|
assert.deepEqual(writes, ["show version\r", "show clock\r"]);
|
|
assert.equal(bufferRef.current, "");
|
|
assert.deepEqual(echoes, ["show version", "\r\n", "show clock", "\r\n"]);
|
|
});
|