From 88e53f56289a77c00caeeab2a4e1bc44539c43a0 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 6 Nov 2020 18:26:25 -0800 Subject: 7202 - rendering screens above other values --- apps/tile/environment.mu | 3 ++- apps/tile/value.mu | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 82ddad5f..9bb00fbc 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -1388,7 +1388,8 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi var dest-offset/ecx: (offset value) <- compute-offset data, top var val/eax: (addr value) <- index data, dest-offset render-value-at screen, curr-row, indented-col, val, max-width - curr-row <- increment + var height/eax: int <- value-height val + curr-row <- add height loop } } diff --git a/apps/tile/value.mu b/apps/tile/value.mu index 3dfa2855..e5c39cff 100644 --- a/apps/tile/value.mu +++ b/apps/tile/value.mu @@ -316,3 +316,27 @@ fn array-width _a: (addr array value) -> _/eax: int { # spaces like other value types return result } + +fn value-height _v: (addr value) -> _/eax: int { + var v/esi: (addr value) <- copy _v + var type/eax: (addr int) <- get v, type + { + compare *type, 3 # file handle + break-if-!= + # TODO: visualizing file handles + return 1 + } + { + compare *type, 4 # screen + break-if-!= + var screen-ah/eax: (addr handle screen) <- get v, screen-data + var screen/eax: (addr screen) <- lookup *screen-ah + compare screen, 0 + break-if-= + var nrows/ecx: (addr int) <- get screen, num-rows + var result/eax: int <- copy *nrows + result <- add 2 # top and bottom border + return result + } + return 1 +} -- cgit 1.4.1-2-gfad0