diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-09 01:44:58 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-09 01:52:24 +0200 |
commit | 11219c7d21c8ec7f438d52de063c4ac25f84711d (patch) | |
tree | 36b1308d747cc467dc7dad2713eb2cc546390026 /src/display/client.nim | |
parent | 6c435aa6c186c2fe7ec72cee2a5ae2f1ae8b22a7 (diff) | |
download | chawan-11219c7d21c8ec7f438d52de063c4ac25f84711d.tar.gz |
add extern, refactor some term functions
* Add an extern() call. Maybe it should be defined on client. It certainly should accept a dictionary instead of the enum type we use now. Perhaps it should return the error code? I'll leave it undocumented until I figure this out. * Refactor enableRawMode, unblockStdin, etc. so that they operate on the term object instead of global state. * Move editor to a separate folder, and factor out runprocess into a different module.
Diffstat (limited to 'src/display/client.nim')
-rw-r--r-- | src/display/client.nim | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/display/client.nim b/src/display/client.nim index 72a42124..c8a4ab1f 100644 --- a/src/display/client.nim +++ b/src/display/client.nim @@ -132,16 +132,14 @@ proc runJSJobs(client: Client) = client.jsrt.runJSJobs(client.console.err) proc evalJS(client: Client, src, filename: string, module = false): JSValue = - if client.console.tty != nil: - unblockStdin(client.console.tty.getFileHandle()) + client.pager.term.unblockStdin() let flags = if module: JS_EVAL_TYPE_MODULE else: JS_EVAL_TYPE_GLOBAL result = client.jsctx.eval(src, filename, flags) client.runJSJobs() - if client.console.tty != nil: - restoreStdin(client.console.tty.getFileHandle()) + client.pager.term.restoreStdin() proc evalJSFree(client: Client, src, filename: string) = JS_FreeValue(client.jsctx, client.evalJS(src, filename)) @@ -231,7 +229,7 @@ proc handleCommandInput(client: Client, c: char) = client.pager.refreshStatusMsg() proc input(client: Client) = - restoreStdin(client.console.tty.getFileHandle()) + client.pager.term.restoreStdin() while true: let c = client.console.readChar() if client.pager.askpromise != nil: |