about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-11 21:50:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-11 21:50:14 -0700
commit9c25023a20c5b4c26030d0b759b0c96999343a46 (patch)
treebf484cf43dc0a01facfad74da0a77d0960905d2e
parent91ae7ff9badc803e7de93fefa7aaf233df13247b (diff)
downloadmu-9c25023a20c5b4c26030d0b759b0c96999343a46.tar.gz
hackily handle overly large posts
We don't have pagination within a single post yet.
-rw-r--r--browse-slack/environment.mu12
1 files changed, 12 insertions, 0 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu
index 88b389cc..13ef1c36 100644
--- a/browse-slack/environment.mu
+++ b/browse-slack/environment.mu
@@ -214,6 +214,18 @@ fn page-down _env: (addr environment), _items: (addr item-list) {
   }
   new-item-index <- increment
   var dest/eax: (addr int) <- get env, item-index
+  {
+    # HACK: make sure we make forward progress even if a single post takes up
+    # the whole screen.
+    # We can't see the rest of that single post at the moment. But at least we
+    # can go past it.
+    compare new-item-index, *dest
+    break-if-!=
+    # Don't make "forward progress" past post 0.
+    compare new-item-index, 0
+    break-if-=
+    new-item-index <- decrement
+  }
   copy-to *dest, new-item-index
 }