Files
Netcatty/components/terminal/runtime/terminalInterruptInputState.ts
T
2026-06-27 17:46:24 +08:00

22 lines
494 B
TypeScript

type StringRef = {
current: string;
};
type InterruptInputStateOptions = {
commandBufferRef: StringRef;
serialLineBufferRef?: StringRef;
onAutocompleteInput?: (data: string) => void;
};
export function clearTerminalInputStateForInterrupt({
commandBufferRef,
serialLineBufferRef,
onAutocompleteInput,
}: InterruptInputStateOptions): void {
commandBufferRef.current = "";
if (serialLineBufferRef) {
serialLineBufferRef.current = "";
}
onAutocompleteInput?.("\x03");
}