diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-13 00:05:05 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-13 00:05:05 -0700 |
commit | af52cb8d1fe6b523cd733c699f72508509be45cc (patch) | |
tree | deeb6974dceb8eb42585e49bff2a70275ef503d1 /apps/tile | |
parent | 54fd7d7a99374945158277193ff2d0976cb0d756 (diff) | |
download | mu-af52cb8d1fe6b523cd733c699f72508509be45cc.tar.gz |
7015 - bugfix in column width computation
I just got bitten by variable shadowing! It's a lot less theoretical concern now.
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/environment.mu | 10 | ||||
-rw-r--r-- | apps/tile/main.mu | 14 |
2 files changed, 15 insertions, 9 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 6e865c38..b0ed4605 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -748,14 +748,11 @@ fn render-line screen: (addr screen), functions: (addr handle function), binding # # Return the farthest column written. fn render-column screen: (addr screen), functions: (addr handle function), bindings: (addr table), scratch: (addr line), final-word: (addr word), top-row: int, left-col: int -> right-col/ecx: int { - var max-width/ecx: int <- copy 0 + var max-width/esi: int <- copy 0 { # indent stack var indented-col/ebx: int <- copy left-col indented-col <- add 1 # margin-right - 2 for padding spaces -#? print-string 0, "rendering stack from " -#? print-int32-decimal 0, indented-col -#? print-string 0, "\n" # compute stack var stack: value-stack var stack-addr/edi: (addr value-stack) <- address stack @@ -765,14 +762,11 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi var curr-row/edx: int <- copy top-row curr-row <- add 3 # stack-margin-top var _max-width/eax: int <- value-stack-max-width stack-addr - var max-width/esi: int <- copy _max-width + max-width <- copy _max-width var i/eax: int <- value-stack-length stack-addr { compare i, 0 break-if-<= -#? print-string 0, "rendering stack row from " -#? print-int32-decimal 0, indented-col -#? print-string 0, "\n" move-cursor screen, curr-row, indented-col { var val/eax: int <- pop-int-from-value-stack stack-addr diff --git a/apps/tile/main.mu b/apps/tile/main.mu index 573a7457..7a57a1b9 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -75,7 +75,19 @@ fn test { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment-with-fake-screen env, 0x30, 0xa0 # 48 rows, 160 columns - var g/eax: grapheme <- copy 0x73 # 's' + var g/eax: grapheme <- copy 0x31 # '1' + process env, g + g <- copy 0x31 + process env, g + g <- copy 0x31 + process env, g + g <- copy 0x31 + process env, g + g <- copy 0x20 # space + process env, g + g <- copy 0x31 + process env, g + g <- copy 0x20 # space process env, g render env } |