From 009559f1fb3ced2ff81f2913293805a492cbc3d8 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 26 Sep 2020 23:07:11 -0700 Subject: 6877 Track just whether to step inside or not. --- apps/tile/data.mu | 2 ++ apps/tile/environment.mu | 26 ++++++++++++++++++++++++-- 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 { -- cgit 1.4.1-2-gfad0