fix(simulation): mirror kitty keyboard protocol (#39741)

This commit is contained in:
Kit Langton 2026-07-30 16:03:21 -04:00 committed by GitHub
parent 22d2012f75
commit 9abd9594de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -41,6 +41,7 @@ export const create = Effect.fn("SimulationRenderer.create")(function* (
...options,
width: cols,
height: rows,
kittyKeyboard: Boolean(options.useKittyKeyboard),
...(recording
? {
stdout: recording as unknown as NodeJS.WriteStream,

View file

@ -43,6 +43,25 @@ test("normalizes named keys for OpenTUI", async () => {
])
})
test("headless input mirrors the configured kitty keyboard protocol", async () => {
await Effect.runPromise(
Effect.scoped(
Effect.gen(function* () {
const renderer = yield* SimulationRenderer.create({ useKittyKeyboard: {} })
const harness = createHarness(renderer)
let key: { readonly name: string; readonly source: string } | undefined
renderer.keyInput.once("keypress", (event) => {
key = event
})
yield* execute(harness, { type: "ui.press", key: "escape" })
expect(key).toMatchObject({ name: "escape", source: "kitty" })
}),
),
)
})
test("clicks a target at relative coordinates through descendant text", async () => {
await Effect.runPromise(
Effect.scoped(