about summary refs log tree commit diff stats
path: root/browse-slack
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-14 16:29:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-14 16:29:25 -0700
commit48afc51fafc7d4fd3e8dde867dbd95d4d54ddb30 (patch)
treee16d9c93b0d2f7ae1123d5e4c56b06ae218591e3 /browse-slack
parent29b268c3593ecd3a210dda84297ca96e1fe1823e (diff)
downloadmu-48afc51fafc7d4fd3e8dde867dbd95d4d54ddb30.tar.gz
slack: menu options for browsing intra-item
Diffstat (limited to 'browse-slack')
-rw-r--r--browse-slack/environment.mu21
1 files changed, 20 insertions, 1 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu
index a802743a..1ec9d28b 100644
--- a/browse-slack/environment.mu
+++ b/browse-slack/environment.mu
@@ -352,19 +352,38 @@ fn render-menu screen: (addr screen), _env: (addr environment) {
 }
 
 fn render-main-menu screen: (addr screen), _env: (addr environment) {
+  var env/edi: (addr environment) <- copy _env
   var width/eax: int <- copy 0
   var y/ecx: int <- copy 0
   width, y <- screen-size screen
   y <- decrement
   set-cursor-position screen, 2/x, y
   {
-    var env/edi: (addr environment) <- copy _env
     var num-tabs/edi: (addr int) <- get env, current-tab-index
     compare *num-tabs, 0
     break-if-<=
     draw-text-rightward-from-cursor screen, " Esc ", width, 0/fg 0xf/bg
     draw-text-rightward-from-cursor screen, " go back  ", width, 0xf/fg, 0/bg
   }
+  $render-main-menu:enter: {
+    draw-text-rightward-from-cursor screen, " Enter ", width, 0/fg 0xf/bg
+    {
+      {
+        var current-tab-index-a/ecx: (addr int) <- get env, current-tab-index
+        var tabs-ah/eax: (addr handle array tab) <- get env, tabs
+        var tabs/eax: (addr array tab) <- lookup *tabs-ah
+        var current-tab-index/ecx: int <- copy *current-tab-index-a
+        var current-tab-offset/ecx: (offset tab) <- compute-offset tabs, current-tab-index
+        var current-tab/ecx: (addr tab) <- index tabs, current-tab-offset
+        var current-tab-intra-item-cursor-position/ecx: (addr int) <- get current-tab, intra-item-cursor-position
+        compare *current-tab-intra-item-cursor-position, 0/user
+      }
+      break-if-!=
+      draw-text-rightward-from-cursor screen, " go to user  ", width, 0xf/fg, 0/bg
+      break $render-main-menu:enter
+    }
+    draw-text-rightward-from-cursor screen, " go to thread  ", width, 0xf/fg, 0/bg
+  }
   draw-text-rightward-from-cursor screen, " / ", width, 0/fg 0xf/bg
   draw-text-rightward-from-cursor screen, " search  ", width, 0xf/fg, 0/bg
   draw-text-rightward-from-cursor screen, " Tab ", width, 0/fg 0xf/bg