about summary refs log tree commit diff stats
path: root/src/display
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-27 22:01:03 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-27 22:16:16 +0100
commit4df668fd2225278d4745a67613efd9859bc8c1a0 (patch)
tree4e689276743ee1deddd8175e1eb09159c6fb0115 /src/display
parentfddc8d8da34b2f05b99d56b3c753a7b00d54ae7c (diff)
downloadchawan-4df668fd2225278d4745a67613efd9859bc8c1a0.tar.gz
Rework broken non-blocking io
Piped input works correctly again!
(Also fix hash's setter not working with url's without a fragment)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/pager.nim17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim
index a50eb9a8..b280d906 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -375,7 +375,7 @@ proc deleteContainer(pager: Pager, container: Container) =
       pager.setContainer(nil)
   container.parent = nil
   container.children.setLen(0)
-  pager.unreg.add((container.process, SocketStream(container.istream)))
+  pager.unreg.add((container.process, SocketStream(container.iface.stream)))
   pager.dispatcher.forkserver.removeChild(container.process)
 
 proc discardBuffer*(pager: Pager) {.jsfunc.} =
@@ -425,7 +425,6 @@ proc gotoURL*(pager: Pager, request: Request, prevurl = none(URL), ctype = none(
     container.replace = replace
     pager.addContainer(container)
   else:
-    pager.container.redirect = some(request.url)
     pager.container.findAnchor(request.url.anchor)
 
 # When the user has passed a partial URL as an argument, they might've meant
@@ -599,8 +598,6 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
     if pager.container == nil:
       return false
   of SUCCESS:
-    container.reshape()
-    pager.container.loadinfo = ""
     if container.replace != nil:
       container.children.add(container.replace.children)
       for child in container.children:
@@ -617,13 +614,15 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
     if pager.container == container:
       pager.authorize()
   of REDIRECT:
-    let redirect = container.redirect.get
+    let redirect = event.location
     pager.alert("Redirecting to " & $redirect)
     pager.gotoURL(newRequest(redirect), some(pager.container.source.location), replace = pager.container)
   of ANCHOR:
-    pager.addContainer(pager.dupeContainer(container, container.redirect))
+    var url2 = newURL(container.source.location)
+    url2.hash(event.anchor)
+    pager.addContainer(pager.dupeContainer(container, some(url2)))
   of NO_ANCHOR:
-    pager.alert("Couldn't find anchor " & container.redirect.get.anchor)
+    pager.alert("Couldn't find anchor " & event.anchor)
   of UPDATE:
     if container == pager.container:
       pager.redraw = true
@@ -636,6 +635,10 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
   of STATUS:
     if pager.container == container:
       pager.refreshStatusMsg()
+  of ALERT:
+    if pager.container == container:
+      pager.alert(event.msg)
+      pager.refreshStatusMsg()
   of NO_EVENT: discard
   return true