about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-01 21:50:24 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-01 21:53:44 +0200
commit52632e4427eca500e3bf6394852db8925e3af6d2 (patch)
tree47ef434301e08411480584462f105c68e1ef9629
parentb57be7b89d656d1eda13f464b41373c2535e106f (diff)
downloadchawan-52632e4427eca500e3bf6394852db8925e3af6d2.tar.gz
buffer: run JS jobs on connected/read/error
Not exactly the cleanest solution, but it should work for now.
(Ideally it would only be called once after the select IF any of the
three occurred on a fetchable file descriptor.)
-rw-r--r--src/buffer/buffer.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index c87a6181..5cbf5893 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -1394,8 +1394,12 @@ proc handleRead(buffer: Buffer, fd: int) =
     buffer.onload()
   elif fd in buffer.loader.connecting:
     buffer.loader.onConnected(fd)
+    if buffer.config.scripting:
+      buffer.window.runJSJobs()
   elif fd in buffer.loader.ongoing:
     buffer.loader.onRead(fd)
+    if buffer.config.scripting:
+      buffer.window.runJSJobs()
   elif fd in buffer.loader.unregistered:
     discard # ignore
   else: assert false
@@ -1411,6 +1415,8 @@ proc handleError(buffer: Buffer, fd: int, err: OSErrorCode) =
     assert false, $fd & ": " & $err
   elif fd in buffer.loader.ongoing:
     buffer.loader.onError(fd)
+    if buffer.config.scripting:
+      buffer.window.runJSJobs()
   elif fd in buffer.loader.unregistered:
     discard # ignore
   else: