From 412a68d0c1a3375f340344265cc3d71dfcfec887 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 15 Aug 2021 04:24:36 -0700 Subject: minimize repaints when navigating between channels --- browse-slack/environment.mu | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'browse-slack') 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 } { -- cgit 1.4.1-2-gfad0