about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-24 15:25:39 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-24 15:25:39 +0200
commit088202c92f86b94262c173d210885c0ae579f148 (patch)
treec11a7fdf640e7320f29e14df1ed77132f2fd6920 /src/local/client.nim
parente0745a3e88d737833c520ae363eaad9d43f1786d (diff)
downloadchawan-088202c92f86b94262c173d210885c0ae579f148.tar.gz
client, timeout: simplify
We don't use the generic feature of selectors, so just unify the
client & buffer timeout types.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index 591e07c7..b7e8d329 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -71,9 +71,9 @@ type
     pager {.jsget.}: Pager
     precnum: int32 # current number prefix (when vi-numeric-prefix is true)
     s: string # current input buffer
-    selector: Selector[Container]
+    selector: Selector[int]
     store {.jsget, jsset.}: Document
-    timeouts: TimeoutState[Container]
+    timeouts: TimeoutState
     userstyle: CSSStylesheet
 
   Console = ref object
@@ -317,7 +317,7 @@ proc acceptBuffers(client: Client) =
     container.setStream(stream)
     let fd = stream.source.getFd()
     client.fdmap[int(fd)] = container
-    client.selector.registerHandle(fd, {Read}, nil)
+    client.selector.registerHandle(fd, {Read}, 0)
     client.pager.handleEvents(container)
   client.pager.procmap.clear()
 
@@ -393,8 +393,8 @@ proc handleError(client: Client, fd: int) =
 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)
+  selector.registerHandle(int(client.console.tty.getFileHandle()), {Read}, 0)
+  let sigwinch = selector.registerSignal(int(SIGWINCH), 0)
   while true:
     let events = client.selector.select(-1)
     for event in events:
@@ -532,11 +532,11 @@ proc launchClient*(client: Client, pages: seq[string],
         dump = not open(tty, "/dev/tty", fmRead)
     else:
       dump = true
-  let selector = newSelector[Container]()
+  let selector = newSelector[int]()
   let efd = int(client.forkserver.estream.fd)
-  selector.registerHandle(efd, {Read}, nil)
+  selector.registerHandle(efd, {Read}, 0)
   client.loader.registerFun = proc(fd: int) =
-    selector.registerHandle(fd, {Read}, nil)
+    selector.registerHandle(fd, {Read}, 0)
   client.loader.unregisterFun = proc(fd: int) =
     selector.unregister(fd)
   client.selector = selector