Files
vue-tui/packages/runtime-tests/integration/pty/fixtures/use-paste-ctrl-c.tsx
T
Yunfei He 369442d4b2 fix(runtime): exit on Ctrl+C under kitty for raw-mode-only apps (#75)
Move the exitOnCtrlC guard into the always-on stdin controller (emitInput),
encoding-agnostic via parseKeypress, so Ctrl+C exits under both the legacy
\x03 byte and the kitty CSI-u form regardless of which composable holds raw
mode (useInput / useFocus / usePaste, or none). Single source of truth —
dropped from useInput. Excludes Ctrl+Shift+C; fast-paths \x03 and only parses
escape-prefixed sequences. Adds TDD PTY coverage and updates the divergence doc.

Also: stop tracking docs/superpowers/plans/2026-05-27-ink-test-parity.md —
docs/ must stay out of git (AGENTS.md); it was committed before .gitignore
covered it.
2026-05-31 00:17:21 +08:00

25 lines
858 B
TypeScript

import process from "node:process";
import { createApp, usePaste } from "@vue-tui/runtime";
import { defineComponent, onMounted } from "vue";
// Regression fixture for the kitty-protocol Ctrl+C exit gap: an app that
// enables raw mode via usePaste() — which turns off the tty's Ctrl+C -> SIGINT
// translation — but never mounts useInput, so it carries no Ctrl+C exit guard
// of its own. With exitOnCtrlC the app must still exit on Ctrl+C under BOTH the
// legacy (\x03) and kitty (CSI-u) encodings, via the always-on stdin
// controller. See .agents/docs/ink-divergences.md.
const PasteOnly = defineComponent(() => {
usePaste(() => {});
onMounted(() => {
process.stdout.write("__READY__");
});
return () => null;
});
const app = createApp(PasteOnly);
app.mount({ exitOnCtrlC: true });
await app.waitUntilExit();
console.log("exited");