about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-15 18:59:18 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-15 18:59:18 +0100
commitf0de405c6614356928d8700e2e95d00d97ffe2f9 (patch)
tree09c20a94ad68c9cf9a53084925a52fc93279d03c /src/display/client.nim
parent4cd5832ec1bfd02e8afdf5777546cadbe5eaaafb (diff)
downloadchawan-f0de405c6614356928d8700e2e95d00d97ffe2f9.tar.gz
Fix console display bugs, add container.location
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 34077055..5162d4aa 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -13,6 +13,7 @@ when defined(posix):
 import std/exitprocs
 
 import bindings/quickjs
+import buffer/buffer
 import buffer/container
 import css/sheet
 import config/config
@@ -123,9 +124,9 @@ proc command0(client: Client, src: string, filename = "<command>", silence = fal
   free(ret)
 
 proc command(client: Client, src: string) =
-  restoreStdin(client.console.tty.getFileHandle())
   client.command0(src)
-  client.console.container.cursorLastLine()
+  client.console.container.requestLines().then(proc() =
+    client.console.container.cursorLastLine())
 
 proc quit(client: Client, code = 0) {.jsfunc.} =
   if client.alive:
@@ -385,6 +386,7 @@ proc newConsole(pager: Pager, tty: File): Console =
       raise newException(Defect, "Failed to open file for console pipe.")
     result.err = newFileStream(f)
     result.err.writeLine("Type (M-c) console.hide() to return to buffer mode.")
+    result.err.flush()
     result.pager = pager
     result.tty = tty
     pager.registerContainer(result.container)
@@ -448,6 +450,7 @@ proc show(console: Console) {.jsfunc.} =
   if console.pager.container != console.container:
     console.prev = console.pager.container
     console.pager.setContainer(console.container)
+    console.container.requestLines()
 
 proc hide(console: Console) {.jsfunc.} =
   if console.pager.container == console.container: