about summary refs log tree commit diff stats
path: root/html/081print.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-05 20:34:09 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-11-05 20:35:17 -0700
commitf9294899d0b952072de3dc87b3ea97e98f150ea4 (patch)
treee962ffc031422cc54c7be1c8ad62846e733c0a9c /html/081print.mu.html
parent15ed8cc164f947d6a49b6b73a00ff9955931ab50 (diff)
downloadmu-f9294899d0b952072de3dc87b3ea97e98f150ea4.tar.gz
3622 - handle fractional coordinates in print
Diffstat (limited to 'html/081print.mu.html')
-rw-r--r--html/081print.mu.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/html/081print.mu.html b/html/081print.mu.html
index 241cf857..5214e80c 100644
--- a/html/081print.mu.html
+++ b/html/081print.mu.html
@@ -141,11 +141,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   height:num <span class="Special">&lt;-</span> get *screen, <span class="Constant">num-rows:offset</span>
   <span class="Comment"># if cursor is out of bounds, silently exit</span>
   row:num <span class="Special">&lt;-</span> get *screen, <span class="Constant">cursor-row:offset</span>
+  row <span class="Special">&lt;-</span> round row
   legal?:bool <span class="Special">&lt;-</span> greater-or-equal row,<span class="Constant"> 0</span>
   <span class="muControl">return-unless</span> legal?
   legal? <span class="Special">&lt;-</span> lesser-than row, height
   <span class="muControl">return-unless</span> legal?
   column:num <span class="Special">&lt;-</span> get *screen, <span class="Constant">cursor-column:offset</span>
+  column <span class="Special">&lt;-</span> round column
   legal? <span class="Special">&lt;-</span> greater-or-equal column,<span class="Constant"> 0</span>
   <span class="muControl">return-unless</span> legal?
   legal? <span class="Special">&lt;-</span> lesser-than column, width
@@ -220,6 +222,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   ]
 ]
 
+<span class="muScenario">scenario</span> print-character-at-fractional-coordinate [
+  <span class="Constant">local-scope</span>
+  fake-screen:&amp;:screen <span class="Special">&lt;-</span> new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span>
+  a:char <span class="Special">&lt;-</span> copy <span class="Constant">97/a</span>
+  run [
+    move-cursor fake-screen, 0.5,<span class="Constant"> 0</span>
+    fake-screen <span class="Special">&lt;-</span> print fake-screen, a:char
+    cell:&amp;:@:screen-cell <span class="Special">&lt;-</span> get *fake-screen, <span class="Constant">data:offset</span>
+    1:@:screen-cell/<span class="Special">raw</span> <span class="Special">&lt;-</span> copy *cell
+  ]
+  memory-should-contain [
+   <span class="Constant"> 1</span> <span class="Special">&lt;-</span><span class="Constant"> 6</span>  <span class="Comment"># width*height</span>
+   <span class="Constant"> 2</span> <span class="Special">&lt;-</span><span class="Constant"> 97</span>  <span class="Comment"># 'a'</span>
+   <span class="Constant"> 3</span> <span class="Special">&lt;-</span><span class="Constant"> 7</span>  <span class="Comment"># white</span>
+    <span class="Comment"># rest of screen is empty</span>
+   <span class="Constant"> 4</span> <span class="Special">&lt;-</span><span class="Constant"> 0</span>
+  ]
+]
+
 <span class="muScenario">scenario</span> print-character-in-color [
   <span class="Constant">local-scope</span>
   fake-screen:&amp;:screen <span class="Special">&lt;-</span> new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span>