diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-25 09:47:55 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-25 09:47:55 -0700 |
commit | d061cbff87aa313e6204781b0569caa2d54c3d11 (patch) | |
tree | a898165a5a2f98b03dbb5fe8dad7726a88bb7a18 /apps/tile | |
parent | 5914ed31a9d5fb097f249cb681bc109eb3ed2a92 (diff) | |
download | mu-d061cbff87aa313e6204781b0569caa2d54c3d11.tar.gz |
6855
Get rid of cutesy justify thresholds. They didn't actually save me any trouble, and they won't generalize to other literals besides ints.
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/environment.mu | 10 | ||||
-rw-r--r-- | apps/tile/int-stack.mu | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index a52db8b8..abe92275 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -242,8 +242,8 @@ fn render-column screen: (addr screen), defs: (addr function), scratch: (addr li # render stack var curr-row/edx: int <- copy top-row curr-row <- add 3 # stack-margin-top - var _justify-threshold/eax: int <- max-stack-justify-threshold stack-addr - var justify-threshold/esi: int <- copy _justify-threshold + var _max-width/eax: int <- int-stack-max-width stack-addr + var max-width/esi: int <- copy _max-width var i/eax: int <- int-stack-length stack-addr { compare i, 0 @@ -251,7 +251,7 @@ fn render-column screen: (addr screen), defs: (addr function), scratch: (addr li move-cursor screen, curr-row, indented-col { var val/eax: int <- pop-int-stack stack-addr - render-integer screen, val, justify-threshold + render-integer screen, val, max-width var size/eax: int <- decimal-size val compare size, max-width break-if-<= @@ -292,7 +292,7 @@ fn render-column screen: (addr screen), defs: (addr function), scratch: (addr li } # synaesthesia -fn render-integer screen: (addr screen), val: int, justify-threshold: int { +fn render-integer screen: (addr screen), val: int, max-width: int { var bg/eax: int <- hash-color val var fg/ecx: int <- copy 7 { @@ -312,7 +312,7 @@ fn render-integer screen: (addr screen), val: int, justify-threshold: int { } start-color screen, fg, bg print-grapheme screen, 0x20 # space - print-int32-decimal-right-justified screen, val, justify-threshold + print-int32-decimal-right-justified screen, val, max-width print-grapheme screen, 0x20 # space } diff --git a/apps/tile/int-stack.mu b/apps/tile/int-stack.mu index 65b9107b..8e58f456 100644 --- a/apps/tile/int-stack.mu +++ b/apps/tile/int-stack.mu @@ -68,7 +68,7 @@ fn int-stack-length _self: (addr int-stack) -> result/eax: int { result <- copy *top-addr } -fn max-stack-justify-threshold _self: (addr int-stack) -> result/eax: int { +fn int-stack-max-width _self: (addr int-stack) -> result/eax: int { var self/esi: (addr int-stack) <- copy _self var data-ah/edi: (addr handle array int) <- get self, data var _data/eax: (addr array int) <- lookup *data-ah @@ -80,11 +80,11 @@ fn max-stack-justify-threshold _self: (addr int-stack) -> result/eax: int { compare i, *top-addr break-if->= var g/edx: (addr int) <- index data, i - var threshold/ecx: int <- right-justify-threshold-decimal *g - compare threshold, result + var w/ecx: int <- int-width-decimal *g + compare w, result { break-if-<= - result <- copy threshold + result <- copy w } i <- increment loop |