about summary refs log tree commit diff stats
path: root/apps/tile/gap-buffer.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-19 22:47:03 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-19 22:47:21 -0700
commit1436f0298f4c6b9a141a4f23fb89f5c00e98175d (patch)
treeafd8ff89fbd4c7b2250a4eb5c11cd6c049d031bf /apps/tile/gap-buffer.mu
parentf32e575e387859af74f7023f9f02b32dee839962 (diff)
downloadmu-1436f0298f4c6b9a141a4f23fb89f5c00e98175d.tar.gz
6812 - tile: render cursor location
Diffstat (limited to 'apps/tile/gap-buffer.mu')
-rw-r--r--apps/tile/gap-buffer.mu8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/tile/gap-buffer.mu b/apps/tile/gap-buffer.mu
index 96e39aed..8a57fc5b 100644
--- a/apps/tile/gap-buffer.mu
+++ b/apps/tile/gap-buffer.mu
@@ -139,7 +139,6 @@ $gap-right:body: {
   }
   {
     var left/ecx: (addr grapheme-stack) <- get self, left
-    # HERE: can't use 'result' here: "unknown variable 'result'"
     push-grapheme-stack left, g
   }
 }
@@ -163,6 +162,13 @@ $gap-left:body: {
 }
 }
 
+fn gap-index _self: (addr gap-buffer) -> result/eax: int {
+  var self/eax: (addr gap-buffer) <- copy _self
+  var left/eax: (addr grapheme-stack) <- get self, left
+  var top-addr/eax: (addr int) <- get left, top
+  result <- copy *top-addr
+}
+
 fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> result/eax: boolean {
 $gap-buffer-equal?:body: {
   var self/esi: (addr gap-buffer) <- copy _self