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-16 20:58:48 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-16 21:01:11 +0100
commita316ae2406bd4d0f1006cdcb572a06b772b10237 (patch)
treea342d673aaf18284103ef78279c8f22b9d8e55d6 /src/display/client.nim
parentc1c5a64ebb7bcc6deace0dce6f6a530039302f7e (diff)
downloadchawan-a316ae2406bd4d0f1006cdcb572a06b772b10237.tar.gz
Allow cycling through hover-texts with u
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 5162d4aa..cf27eac4 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -140,6 +140,11 @@ proc feedNext(client: Client) {.jsfunc.} =
 proc alert(client: Client, msg: string) {.jsfunc.} =
   client.pager.alert(msg)
 
+proc handlePagerEvents(client: Client) =
+  let container = client.pager.container
+  if container != nil and not client.pager.handleEvents(container):
+    client.quit(1)
+
 proc input(client: Client) =
   restoreStdin(client.console.tty.getFileHandle())
   while true:
@@ -169,6 +174,7 @@ proc input(client: Client) =
       let action = getNormalAction(client.config, client.s)
       client.evalJSFree(action, "<command>")
       if not client.feedNext:
+        client.handlePagerEvents()
         client.pager.refreshStatusMsg()
     if not client.feedNext:
       client.s = ""
@@ -282,10 +288,7 @@ proc inputLoop(client: Client) =
       if Read in event.events:
         if event.fd == client.console.tty.getFileHandle():
           client.input()
-          let container = client.pager.container
-          if container != nil and not client.pager.handleEvents(container):
-            client.quit(1)
-          stdout.flushFile()
+          client.handlePagerEvents()
         else:
           let container = client.fdmap[event.fd]
           if not client.pager.handleEvent(container):
@@ -310,7 +313,7 @@ proc inputLoop(client: Client) =
     if client.pager.scommand != "":
       client.command(client.pager.scommand)
       client.pager.scommand = ""
-      client.pager.refreshStatusMsg()
+      client.handlePagerEvents()
     client.pager.draw()
     client.acceptBuffers()
 
@@ -334,10 +337,6 @@ proc dumpLoop(client: Client) =
           let timeout = client.timeouts[id]
           timeout.handler()
           client.clearTimeout(id)
-    if client.pager.scommand != "":
-      client.command(client.pager.scommand)
-      client.pager.scommand = ""
-      client.pager.refreshStatusMsg()
     client.acceptBuffers()
 
 proc headlessLoop(client: Client) =