diff options
Diffstat (limited to 'v2/screen.ts')
-rw-r--r-- | v2/screen.ts | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/v2/screen.ts b/v2/screen.ts index 4da6482..7a1e265 100644 --- a/v2/screen.ts +++ b/v2/screen.ts @@ -1,7 +1,4 @@ import type { Element, Input, Text, Button } from "./elements.ts" -import readline from 'node:readline'; - -readline.emitKeypressEvents(process.stdin); const logs: string[] = []; @@ -32,7 +29,7 @@ export class Screen { handleKeypress(chunk: any, key: any, screen: Screen) { const focusableIDs = Object.keys(screen.getFocusable()); const focusedIndex = focusableIDs.indexOf(screen.focusedElementId); - if (key && key.name == 'escape') { + if (key && key.name == 'escape' || key.name == "c" && key.ctrl) { onexit(); process.exit(); } @@ -101,5 +98,3 @@ export class Screen { return this.focusedElementId ? this.elements.get(this.focusedElementId) as Element : undefined } } - -if (process.stdin.isTTY) process.stdin.setRawMode(true); // makes the terminal send stdin without the user pressing enter |