import { importForRuntime } from './runtime.ts'; import { Editor } from './editor.ts'; export * from './runtime.ts'; export * from './strings.ts'; export * from './termios.ts'; export type { ITestBase } from './test_base.ts'; const decoder = new TextDecoder(); export async function main() { const { inputLoop, init } = await importForRuntime('mod.ts'); // Set up handlers to enable/disable raw mode for each runtime await init(); // Create the editor itself const editor = new Editor(); // The main event loop for await (const chunk of inputLoop()) { const char = String(decoder.decode(chunk)); // Clear the screen for output await editor.refreshScreen(); // Process input const shouldLoop = editor.processKeyPress(char); if (!shouldLoop) { return 0; } } return -1; }