about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-26 23:07:11 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-26 23:07:11 -0700
commit009559f1fb3ced2ff81f2913293805a492cbc3d8 (patch)
treed6fb882e036f6f59fece3022dbc517019faa73f3
parent866e6e72a84c33a83f6b0d1dcc259050b8ca0681 (diff)
downloadmu-009559f1fb3ced2ff81f2913293805a492cbc3d8.tar.gz
6877
Track just whether to step inside or not.
-rw-r--r--apps/tile/data.mu2
-rw-r--r--apps/tile/environment.mu26
2 files changed, 26 insertions, 2 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu
index 9b852a82..855a9779 100644
--- a/apps/tile/data.mu
+++ b/apps/tile/data.mu
@@ -31,6 +31,8 @@ type word {
   scalar-data: (handle gap-buffer)
   text-data: (handle array byte)
   box-data: (handle line)  # recurse
+  # other metadata attached to this word
+  display-subsidiary-stack?: boolean
   next: (handle word)
   prev: (handle word)
 }
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 399901ac..ba74a20e 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -142,6 +142,18 @@ $process:body: {
       copy-object next-word-ah, cursor-word-ah
       break $process:body
     }
+    compare key, 0xa  # enter
+    {
+      break-if-!=
+      # toggle display of subsidiary stack
+      var cursor-word-ah/edx: (addr handle word) <- get self, cursor-word
+      var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+      var display-subsidiary-stack?/eax: (addr boolean) <- get cursor-word, display-subsidiary-stack?
+      var tmp/ecx: int <- copy 1
+      tmp <- subtract *display-subsidiary-stack?
+      copy-to *display-subsidiary-stack?, tmp
+      break $process:body
+    }
     # otherwise insert key within current word
     var g/edx: grapheme <- copy key
     var print?/eax: boolean <- real-grapheme? key
@@ -218,7 +230,17 @@ fn render-line screen: (addr screen), defs: (addr handle function), bindings: (a
   {
     compare curr-word, 0
     break-if-=
-    move-cursor screen, top-row, curr-col
+    # if necessary, first render columns for subsidiary stack
+    $render-line:subsidiary: {
+      {
+        var display-subsidiary-stack?/eax: (addr boolean) <- get curr-word, display-subsidiary-stack?
+        compare *display-subsidiary-stack?, 0  # false
+        break-if-= $render-line:subsidiary
+      }
+      # HERE
+      print-string screen, "!"
+    }
+    # now render main column
     curr-col <- render-column screen, defs, bindings, line, curr-word, top-row, curr-col, cursor-word, cursor-col-a
     var next-word-ah/edx: (addr handle word) <- get curr-word, next
     curr-word <- lookup *next-word-ah
@@ -350,7 +372,7 @@ fn clear-canvas _env: (addr environment) {
   reset-formatting screen
   print-string screen, " tbd  "
   move-cursor screen, 3, 2
-  print-string screen, "x f = 2 x *"
+  print-string screen, "x 2* = 2 x *"
 }
 
 fn real-grapheme? g: grapheme -> result/eax: boolean {