From 9c25023a20c5b4c26030d0b759b0c96999343a46 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 11 Aug 2021 21:50:14 -0700 Subject: [PATCH] hackily handle overly large posts We don't have pagination within a single post yet. --- browse-slack/environment.mu | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 }