mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
* fix(terminal): separate prompt after unterminated command output Add a display-layer prompt line break handler so recognized shell prompts move to the next visual line when the final command output line is not newline terminated. Also add a terminal setting to toggle the behavior, sync support, i18n copy, and focused tests for prompt insertion. * fix review issue * Fix prompt cache initialization * Serialize terminal output writes for prompt breaks * Keep terminal status lines ordered with output * Fix prompt arming without command callback * Keep prompt display breaks out of session logs * Avoid prompt breaks for output suffix matches --------- Co-authored-by: yuzifu <yuzifu@TB16PGen5.Info> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
26 lines
788 B
TypeScript
26 lines
788 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { recordTerminalCommandExecution } from "./terminalCommandExecution";
|
|
import { createPromptLineBreakState } from "./promptLineBreak";
|
|
|
|
test("command execution arms prompt line break even without command history callback", () => {
|
|
const promptState = createPromptLineBreakState();
|
|
const commandBufferRef = { current: "echo ok" };
|
|
|
|
recordTerminalCommandExecution("echo ok", {
|
|
host: {
|
|
id: "host-1",
|
|
label: "Host",
|
|
hostname: "example.test",
|
|
username: "alice",
|
|
},
|
|
sessionId: "session-1",
|
|
commandBufferRef,
|
|
promptLineBreakStateRef: { current: promptState },
|
|
});
|
|
|
|
assert.equal(commandBufferRef.current, "");
|
|
assert.equal(promptState.pendingCommand, true);
|
|
});
|