about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-06 18:26:25 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-06 18:26:25 -0800
commit88e53f56289a77c00caeeab2a4e1bc44539c43a0 (patch)
tree30ba1655cec21658826ef5f3b6fc93626bad414b
parent1f77feff37d335a4271f4f4504c1582380044809 (diff)
downloadmu-88e53f56289a77c00caeeab2a4e1bc44539c43a0.tar.gz
7202 - rendering screens above other values
-rw-r--r--apps/tile/environment.mu3
-rw-r--r--apps/tile/value.mu24
2 files changed, 26 insertions, 1 deletions
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
+}