about summary refs log tree commit diff stats
path: root/browse-slack/environment.mu
diff options
context:
space:
mode:
Diffstat (limited to 'browse-slack/environment.mu')
-rw-r--r--browse-slack/environment.mu22
1 files changed, 14 insertions, 8 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu
index 4c8fd659..fc0e6be2 100644
--- a/browse-slack/environment.mu
+++ b/browse-slack/environment.mu
@@ -542,14 +542,20 @@ fn previous-item _env: (addr environment), users: (addr array user), channels: (
   var current-tab-index/eax: int <- copy *current-tab-index-a
   var current-tab-offset/eax: (offset tab) <- compute-offset tabs, current-tab-index
   var current-tab/edx: (addr tab) <- index tabs, current-tab-offset
-  var items/esi: (addr item-list) <- copy _items
-  var items-data-first-free-a/ecx: (addr int) <- get items, data-first-free
-  var final-item-index/ecx: int <- copy *items-data-first-free-a
-  final-item-index <- decrement
-  var dest/eax: (addr int) <- get current-tab, item-index
-  compare *dest, final-item-index
-  break-if->=
-  increment *dest
+  var current-tab-type/eax: (addr int) <- get current-tab, type
+  compare *current-tab-type, 0/all-items
+  {
+    break-if-!=
+    var items/esi: (addr item-list) <- copy _items
+    var items-data-first-free-a/ecx: (addr int) <- get items, data-first-free
+    var final-item-index/ecx: int <- copy *items-data-first-free-a
+    final-item-index <- decrement
+    var dest/eax: (addr int) <- get current-tab, item-index
+    compare *dest, final-item-index
+    break-if->=
+    increment *dest
+    return
+  }
 }
 
 fn page-down _env: (addr environment), users: (addr array user), channels: (addr array channel), _items: (addr item-list) {