MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / eventToInputStep

Function eventToInputStep

packages/node/src/testing/ptyScenario.ts:284–304  ·  view source on GitHub ↗
(
  scenario: ScenarioDefinition,
  step: ScenarioDefinition["scriptedInput"][number],
)

Source from the content-addressed store, hash-verified

282}
283
284function eventToInputStep(
285 scenario: ScenarioDefinition,
286 step: ScenarioDefinition["scriptedInput"][number],
287): PtyInputStep {
288 switch (step.event.kind) {
289 case "text":
290 return Object.freeze({ kind: "write", data: step.event.text });
291 case "paste": {
292 const data = scenario.capabilityProfile.supportsBracketedPaste
293 ? `\u001b[200~${step.event.text}\u001b[201~`
294 : step.event.text;
295 return Object.freeze({ kind: "write", data });
296 }
297 case "resize":
298 return Object.freeze({ kind: "resize", cols: step.event.cols, rows: step.event.rows });
299 case "terminalBytes":
300 return Object.freeze({ kind: "write", data: step.event.bytes });
301 case "key":
302 return Object.freeze({ kind: "write", data: keyToBytes(step.event.key, step.event.mods) });
303 }
304}
305
306function combineCursor(
307 terminalCursor: TerminalScreenCursor,

Callers 1

runPtyScenarioFunction · 0.85

Calls 1

keyToBytesFunction · 0.85

Tested by

no test coverage detected