about summary refs log tree commit diff stats
path: root/src/display/pager.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/display/pager.nim')
-rw-r--r--src/display/pager.nim17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim
index 47845956..9bb65b3c 100644
--- a/src/display/pager.nim
+++ b/src/display/pager.nim
@@ -739,8 +739,7 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
       pager.gotoURL(newRequest(container.retry.pop()), ctype = container.contenttype)
     else:
       pager.alert("Can't load " & $container.source.location & " (error code " & $container.code & ")")
-    if pager.container == nil:
-      return false
+    return false
   of SUCCESS:
     if container.replace != nil:
       let n = container.replace.children.find(container)
@@ -775,8 +774,7 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
     else:
       pager.alert("Error: maximum redirection depth reached")
       pager.deleteContainer(container)
-      if pager.container == nil:
-        return false
+      return false
   of ANCHOR:
     var url2 = newURL(container.source.location)
     url2.hash(event.anchor)
@@ -810,19 +808,18 @@ proc handleEvent0(pager: Pager, container: Container, event: ContainerEvent): bo
   of NO_EVENT: discard
   return true
 
-proc handleEvents*(pager: Pager, container: Container): bool =
+proc handleEvents*(pager: Pager, container: Container) =
   while container.events.len > 0:
     let event = container.events.popFirst()
     if not pager.handleEvent0(container, event):
-      return false
-  return true
+      break
 
-proc handleEvent*(pager: Pager, container: Container): bool =
+proc handleEvent*(pager: Pager, container: Container) =
   try:
     container.handleEvent()
+    pager.handleEvents(container)
   except IOError:
-    return false
-  return pager.handleEvents(container)
+    discard
 
 proc addPagerModule*(ctx: JSContext) =
   ctx.registerType(Pager)
n161'>161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271