about summary refs log tree commit diff stats
path: root/apps/browse
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-10 20:14:17 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-10 20:14:17 -0700
commit4eedb6803a75dd2623cb8ef506abd4e32053af8b (patch)
tree8a3e0b81a77c6a0935fce4f2c9ded2f0a20d06b2 /apps/browse
parent3f4aedd8c936adf84113f8be06245f0220bf3015 (diff)
downloadmu-4eedb6803a75dd2623cb8ef506abd4e32053af8b.tar.gz
6763
Diffstat (limited to 'apps/browse')
-rw-r--r--apps/browse/paginated-screen.mu83
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/browse/paginated-screen.mu b/apps/browse/paginated-screen.mu
index 86ec5b6b..bed29dd8 100644
--- a/apps/browse/paginated-screen.mu
+++ b/apps/browse/paginated-screen.mu
@@ -358,6 +358,89 @@ fn test-print-multiple-pages-2 {
   # currently it's hard-coded that we avoid printing to the bottom-most row of the screen
 }
 
+fn test-print-multiple-pages-with-margins {
+  var pg-on-stack: paginated-screen
+  var pg/eax: (addr paginated-screen) <- address pg-on-stack
+  initialize-fake-paginated-screen pg, 3, 6, 2, 1, 1  # 3 rows, 5 columns, 2 pages * 2 columns each
+  start-drawing pg
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x61   # 'a'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x62   # 'b'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x63   # 'c'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x64   # 'd'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x65   # 'e'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x66   # 'f'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x67   # 'g'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var c/ecx: grapheme <- copy 0x68   # 'h'
+  add-grapheme pg, c
+#?   {
+#?     var foo/eax: boolean <- done-drawing? pg
+#?     var foo2/eax: int <- copy foo
+#?     print-int32-hex-to-real-screen foo2
+#?     print-string-to-real-screen "\n"
+#?   }
+  var screen-ah/eax: (addr handle screen) <- get pg, screen
+  var screen-addr/eax: (addr screen) <- lookup *screen-ah
+  check-screen-row screen-addr, 1, "      ", "F - test-print-multiple-pages-with-margins/row1"
+  check-screen-row screen-addr, 2, " ab ef", "F - test-print-multiple-pages-with-margins/row2"
+  check-screen-row screen-addr, 3, " cd gh", "F - test-print-multiple-pages-with-margins/row3"
+  # currently it's hard-coded that we avoid printing to the bottom-most row of the screen
+}
+
 fn initialize-fake-paginated-screen _self: (addr paginated-screen), nrows: int, ncols: int, page-width: int, top-margin: int, left-margin: int {
   var self/esi: (addr paginated-screen) <- copy _self
   var screen-ah/eax: (addr handle screen) <- get self, screen