diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-27 10:31:21 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-27 10:31:21 -0700 |
commit | 603b4c47ddb25596e262e0f7598f9c3c0a89cc49 (patch) | |
tree | 1b5e4fa2089fe65c1a0edff5088485d6185922b1 /apps/tile | |
parent | 5df70f4dfffdb7543f414a826da3343a8f3d0fb4 (diff) | |
download | mu-603b4c47ddb25596e262e0f7598f9c3c0a89cc49.tar.gz |
7128
More consistent spacing in sandbox render.
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/value-stack.mu | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu index f196cb57..8da8c920 100644 --- a/apps/tile/value-stack.mu +++ b/apps/tile/value-stack.mu @@ -137,7 +137,7 @@ fn value-stack-max-width _self: (addr value-stack) -> result/eax: int { break-if->= var o/edx: (offset value) <- compute-offset data, i var v/edx: (addr value) <- index data, o - var w/eax: int <- value-width v + var w/eax: int <- value-width v, 1 # top-level=true # if (w > out) w = out { compare w, out @@ -150,7 +150,7 @@ fn value-stack-max-width _self: (addr value-stack) -> result/eax: int { result <- copy out } -fn value-width _v: (addr value) -> result/eax: int { +fn value-width _v: (addr value), top-level: boolean -> result/eax: int { var out/edi: int <- copy 0 $value-width:core: { var v/esi: (addr value) <- copy _v @@ -177,8 +177,14 @@ fn value-width _v: (addr value) -> result/eax: int { break-if-<= out <- copy 0xd } - # we won't add 2 for surrounding quotes since we don't surround arrays - # in spaces like other value types + # if it's a nested string, include space for quotes + # we don't do this for the top-level, where the quotes will overflow + # into surrounding padding. + compare top-level, 0 # false + { + break-if-!= + out <- add 2 + } break $value-width:core } { @@ -224,7 +230,7 @@ fn array-width _a: (addr array value) -> result/eax: int { var off/ecx: (offset value) <- compute-offset a, i var x/ecx: (addr value) <- index a, off { - var w/eax: int <- value-width x + var w/eax: int <- value-width x, 0 out <- add w } i <- increment |