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-15 04:24:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-15 04:24:36 -0700
commit412a68d0c1a3375f340344265cc3d71dfcfec887 (patch)
treedd932d33eccb99307eb4f0bb678ad546addbb3c2 /browse-slack
parent7282b475ae6a97b8cea3e6b7681bc333a8b5c878 (diff)
downloadmu-412a68d0c1a3375f340344265cc3d71dfcfec887.tar.gz
minimize repaints when navigating between channels
Diffstat (limited to 'browse-slack')
-rw-r--r--browse-slack/environment.mu13
1 files changed, 13 insertions, 0 deletions
diff --git a/browse-slack/environment.mu b/browse-slack/environment.mu
index f7501439..0b829d1d 100644
--- a/browse-slack/environment.mu
+++ b/browse-slack/environment.mu
@@ -80,6 +80,16 @@ fn render-environment screen: (addr screen), _env: (addr environment), users: (a
       render-search-menu screen, env
       return
     }
+    # minimize repaints when focus in channel nav
+    {
+      var cursor-in-channels?/eax: (addr boolean) <- get env, cursor-in-channels?
+      compare *cursor-in-channels?, 0/false
+      break-if-=
+      render-channels screen, env, channels
+      clear-rect screen, 0/x 0x2f/y, 0x80/x 0x30/y, 0/bg
+      render-channels-menu screen, env
+      return
+    }
   }
   # full repaint
   clear-screen screen
@@ -785,6 +795,9 @@ fn update-environment _env: (addr environment), key: byte, users: (addr array us
     break-if-!=
     # toggle cursor between main panel and channels nav
     not *cursor-in-channels?  # bitwise NOT; only works if you never assign 1/true to this variable
+    # do one more repaint
+    var dirty?/eax: (addr boolean) <- get env, dirty?
+    copy-to *dirty?, 1/true
     return
   }
   {