about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-29 12:28:04 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-29 12:28:04 +0100
commitd7a05e7a58d0c2de3078fc9854534974c7e347d4 (patch)
tree7e5bc4327631ac4106d885b5d5e74bfb1cfa3d64 /src/display/client.nim
parentf65667797376e65d8e19e1aa514d160210013540 (diff)
downloadchawan-d7a05e7a58d0c2de3078fc9854534974c7e347d4.tar.gz
Add line editing history, other lineedit fixes
It's still kind of broken...
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 34477c1a..2fd8bb89 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -264,8 +264,12 @@ proc log(console: Console, ss: varargs[string]) {.jsfunc.} =
   console.err.write('\n')
   console.err.flush()
 
+proc c_setvbuf(f: File, buf: pointer, mode: cint, size: csize_t): cint {.
+  importc: "setvbuf", header: "<stdio.h>", tags: [].}
+
 proc inputLoop(client: Client) =
   let selector = client.selector
+  discard c_setvbuf(client.console.tty, nil, IONBF, 0)
   selector.registerHandle(int(client.console.tty.getFileHandle()), {Read}, nil)
   let sigwinch = selector.registerSignal(int(SIGWINCH), nil)
   let redrawtimer = client.selector.registerTimer(1000, false, nil)