mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-19 22:45:45 +00:00
* feat(terminal): split compose-bar send target from toolbar broadcast Toolbar broadcast still fans out keystrokes, paste, and terminal-path snippets. The compose-bar indicator is now a toggle for whether Enter sends to broadcast peers or only the active session. Turning the toolbar switch on or off resets that target to follow it; later flips stay independent. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): keep active-only compose sends off the toolbar fan-out The focused workspace executor omitted broadcast, so executeSnippetCommand fell back to the toolbar switch and still wrote every peer. Pass broadcast: false on that path. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
import { shouldBroadcastTerminalUserInput } from "./terminalUserPaste.ts";
|
|
|
|
test("toolbar broadcast still fans terminal keystrokes out to peers", () => {
|
|
const term = {};
|
|
assert.equal(
|
|
shouldBroadcastTerminalUserInput(term, "ls", {
|
|
isBroadcastEnabled: true,
|
|
hasBroadcastInputHandler: true,
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
shouldBroadcastTerminalUserInput(term, "ls", {
|
|
isBroadcastEnabled: false,
|
|
hasBroadcastInputHandler: true,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
test("keystroke fan-out stays on the toolbar gate and ignores the compose-bar target", () => {
|
|
const runtime = readFileSync(new URL("./createXTermRuntime.ts", import.meta.url), "utf8");
|
|
assert.match(runtime, /isBroadcastEnabled: ctx\.isBroadcastEnabledRef\.current/);
|
|
assert.match(
|
|
runtime,
|
|
/onBroadcastInput\?\.\(broadcastData, ctx\.sessionId, sensitive \? \{ sourceSensitive: true \} : undefined\)/,
|
|
);
|
|
assert.doesNotMatch(runtime, /composeSendToAll|composePeerFanOut/);
|
|
|
|
const layer = readFileSync(new URL("../../TerminalLayer.tsx", import.meta.url), "utf8");
|
|
assert.match(layer, /includeGlobalPeersWithoutToolbar: options\?\.composePeerFanOut === true/);
|
|
const keystrokeCall = layer.slice(
|
|
layer.indexOf("const handleBroadcastInput"),
|
|
layer.indexOf("const handleCommandSubmitted"),
|
|
);
|
|
assert.doesNotMatch(keystrokeCall, /isComposeSendToAll/);
|
|
});
|