about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-04 21:30:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-04 21:47:59 -0700
commit2177b38a68857c15657848cf7fb147a7bc5e033e (patch)
treeec4e4c01bc6891b96c186b63d22c811926ba376c
parent1f05bdcc3458c314c5bcbb390feca50b1c08832a (diff)
downloadmu-2177b38a68857c15657848cf7fb147a7bc5e033e.tar.gz
conditionally display cursor on function side
Always shows at top-most function.
Can't actually do any editing yet.
-rw-r--r--shell/environment.mu2
-rw-r--r--shell/global.mu7
2 files changed, 5 insertions, 4 deletions
diff --git a/shell/environment.mu b/shell/environment.mu
index b63b33f1..7aa9970b 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -26,7 +26,7 @@ fn render-environment screen: (addr screen), _self: (addr environment) {
   var cursor-in-globals-a/eax: (addr boolean) <- get self, cursor-in-globals?
   var cursor-in-globals?/eax: boolean <- copy *cursor-in-globals-a
   var globals/ecx: (addr global-table) <- get self, globals
-  render-globals screen, globals
+  render-globals screen, globals, cursor-in-globals?
   var sandbox/edx: (addr sandbox) <- get self, sandbox
   var cursor-in-sandbox?/ebx: boolean <- copy 1/true
   cursor-in-sandbox? <- subtract cursor-in-globals?
diff --git a/shell/global.mu b/shell/global.mu
index c2b600e7..ebb9a66d 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -112,7 +112,7 @@ fn write-globals out: (addr stream byte), _self: (addr global-table) {
 }
 
 # globals layout: 1 char padding, 41 code, 1 padding, 41 code, 1 padding =  85 chars
-fn render-globals screen: (addr screen), _self: (addr global-table) {
+fn render-globals screen: (addr screen), _self: (addr global-table), show-cursor?: boolean {
   clear-rect screen, 0/xmin, 0/ymin, 0x55/xmax, 0x2f/ymax=screen-height-without-menu, 0xdc/bg=green-bg
   var self/esi: (addr global-table) <- copy _self
   compare self, 0
@@ -164,16 +164,17 @@ fn render-globals screen: (addr screen), _self: (addr global-table) {
         compare y, y2
         {
           break-if->=
-          x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, 1/padding-left, y1, 0x2a/xmax, 0x2f/ymax, 0/no-cursor, 7/fg=definition, 0xc5/bg=blue-bg
+          x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, 1/padding-left, y1, 0x2a/xmax, 0x2f/ymax, show-cursor?, 7/fg=definition, 0xc5/bg=blue-bg
           y <- add 2
           copy-to y1, y
           break $render-globals:render-global
         }
-        x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, 0x2b/xmin, y2, 0x54/xmax, 0x2f/ymax, 0/no-cursor, 7/fg=definition, 0xc5/bg=blue-bg
+        x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, 0x2b/xmin, y2, 0x54/xmax, 0x2f/ymax, show-cursor?, 7/fg=definition, 0xc5/bg=blue-bg
         y <- add 2
         copy-to y2, y
       }
     }
+    copy-to show-cursor?, 0/false
     curr-index <- decrement
     loop
   }