diff options
Diffstat (limited to 'apps/tile/environment.mu')
-rw-r--r-- | apps/tile/environment.mu | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index bdf9574c..e37b32ba 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -424,6 +424,7 @@ $process-sandbox:body: { break $process-sandbox:body } # if start of word is quote and grapheme before cursor is not, just insert it as usual + # TODO: support string escaping { var first-grapheme/eax: grapheme <- first-grapheme cursor-word compare first-grapheme, 0x22 # double quote @@ -433,6 +434,17 @@ $process-sandbox:body: { break-if-= break $process-sandbox:space } + # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual + # TODO: support nested arrays + { + var first-grapheme/eax: grapheme <- first-grapheme cursor-word + compare first-grapheme, 0x5b # '[' + break-if-!= + var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word + compare final-grapheme, 0x5d # ']' + break-if-= + break $process-sandbox:space + } # otherwise insert word after and move cursor to it for the next key # (but we'll continue to track the current cursor-word for the rest of this function) append-word cursor-word-ah @@ -1352,6 +1364,14 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi print-string screen, val break $render-column:render-value } + { + compare *val-type, 2 # array + break-if-!= + var val-ah/eax: (addr handle array int) <- get val-addr, array-data + var val/eax: (addr array int) <- lookup *val-ah + render-array screen, val + break $render-column:render-value + } # render ints by default for now var val-addr2/eax: (addr int) <- get val-addr, int-data render-integer screen, *val-addr2, max-width @@ -1410,6 +1430,14 @@ fn render-integer screen: (addr screen), val: int, max-width: int { print-grapheme screen, 0x20 # space } +fn render-array screen: (addr screen), val: (addr array int) { + start-color screen, 0, 7 + # don't surround in spaces + print-grapheme screen, 0x5b # '[' + print-array-of-ints-in-decimal screen, val + print-grapheme screen, 0x5d # ']' +} + fn hash-color val: int -> result/eax: int { result <- try-modulo val, 7 # assumes that 7 is always the background color } |