22 lines
494 B
TypeScript
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");
|
||
|
|
}
|