about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-04 21:42:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-04 21:48:29 -0700
commit11e8d83d61c59aa7c4cf6b426664a1d4cd921883 (patch)
tree26215f9a41c29761f8fd03ba7302e68c692728cd
parent2177b38a68857c15657848cf7fb147a7bc5e033e (diff)
downloadmu-11e8d83d61c59aa7c4cf6b426664a1d4cd921883.tar.gz
record the definition the cursor is currently at
-rw-r--r--shell/global.mu11
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/global.mu b/shell/global.mu
index ebb9a66d..bd076bb8 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -1,6 +1,7 @@
 type global-table {
   data: (handle array global)
   final-index: int
+  cursor-index: int
 }
 
 type global {
@@ -151,6 +152,15 @@ fn render-globals screen: (addr screen), _self: (addr global-table), show-cursor
       break $render-globals:loop
     }
     {
+      var show-cursor?/edi: boolean <- copy show-cursor?
+      {
+        compare show-cursor?, 0/false
+        break-if-=
+        var cursor-index/eax: (addr int) <- get self, cursor-index
+        compare *cursor-index, curr-index
+        break-if-=
+        show-cursor? <- copy 0/false
+      }
       var curr-offset/edx: (offset global) <- compute-offset data, curr-index
       var curr/edx: (addr global) <- index data, curr-offset
       var curr-input-ah/edx: (addr handle gap-buffer) <- get curr, input
@@ -174,7 +184,6 @@ fn render-globals screen: (addr screen), _self: (addr global-table), show-cursor
         copy-to y2, y
       }
     }
-    copy-to show-cursor?, 0/false
     curr-index <- decrement
     loop
   }