summary refs log tree commit diff
path: root/v2/screen.ts
diff options
context:
space:
mode:
authorwlodekm <[email protected]>2024-11-10 20:07:33 +0200
committerwlodekm <[email protected]>2024-11-10 20:07:33 +0200
commit91b3570414cfdb4d4751e28006bf373d626d372a (patch)
treebaee5103f682977074b0e0c71f890fddf912df89 /v2/screen.ts
parent276b4f6553c8e14537899f75c0a60b11d14f148d (diff)
ok v1.0
Diffstat (limited to 'v2/screen.ts')
-rw-r--r--v2/screen.ts7
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