about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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
+}