about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-28 22:57:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-28 22:57:22 -0700
commitbc859a7ca4713b290fa9d7dea187fde55568ab29 (patch)
tree39401d36682fe391816f1ce5bbceabf065524c7b
parent468927ee1c8b551e50bc4a9e3a2ed689420e1766 (diff)
downloadmu-bc859a7ca4713b290fa9d7dea187fde55568ab29.tar.gz
.
-rw-r--r--317abort.subx3
-rw-r--r--501draw-text.mu10
-rw-r--r--504test-screen.mu24
-rw-r--r--apps/colors.mu3
-rw-r--r--apps/rpn.mu5
-rw-r--r--shell/sandbox.mu5
6 files changed, 21 insertions, 29 deletions
diff --git a/317abort.subx b/317abort.subx
index 2b464658..e4f07971 100644
--- a/317abort.subx
+++ b/317abort.subx
@@ -311,8 +311,7 @@ draw-slice-wrapping-right-then-down-from-cursor-over-full-screen:  # screen: (ad
       73/jump-if-addr>= break/disp8
       # print *curr
       8a/byte-> *ecx 0/r32/eax
-      (draw-grapheme-at-cursor *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
-      (move-cursor-rightward-and-downward *(ebp+8))
+      (draw-grapheme-at-cursor-over-full-screen *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18))
       #
       41/increment-ecx
       #
diff --git a/501draw-text.mu b/501draw-text.mu
index d87fc04a..9f526497 100644
--- a/501draw-text.mu
+++ b/501draw-text.mu
@@ -81,17 +81,21 @@ fn move-cursor-to-left-margin-of-next-line screen: (addr screen) {
   set-cursor-position screen, cursor-x, cursor-y
 }
 
-fn draw-grapheme-at-cursor screen: (addr screen), g: grapheme, color: int, background-color: int {
+fn draw-grapheme-at-cursor-over-full-screen screen: (addr screen), g: grapheme, color: int, background-color: int {
   var cursor-x/eax: int <- copy 0
   var cursor-y/ecx: int <- copy 0
   cursor-x, cursor-y <- cursor-position screen
   draw-grapheme screen, g, cursor-x, cursor-y, color, background-color
+  var width/eax: int <- copy 0
+  var dummy/ecx: int <- copy 0
+  width, dummy <- screen-size screen
+  move-cursor-rightward-and-downward screen, 0 width
 }
 
 # we can't really render non-ASCII yet, but when we do we'll be ready
-fn draw-code-point-at-cursor screen: (addr screen), c: code-point, color: int, background-color: int {
+fn draw-code-point-at-cursor-over-full-screen screen: (addr screen), c: code-point, color: int, background-color: int {
   var g/eax: grapheme <- copy c
-  draw-grapheme-at-cursor screen, g, color, background-color
+  draw-grapheme-at-cursor-over-full-screen screen, g, color, background-color
 }
 
 # draw a single line of text from x, y to xmax
diff --git a/504test-screen.mu b/504test-screen.mu
index da146fb6..c73d0aa6 100644
--- a/504test-screen.mu
+++ b/504test-screen.mu
@@ -43,15 +43,13 @@ fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr
         failure-count <- increment
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+        draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+        draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
         move-cursor-to-left-margin-of-next-line 0/screen
       }
@@ -125,15 +123,13 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
           count-test-failure
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
           move-cursor-to-left-margin-of-next-line 0/screen
         }
@@ -149,8 +145,7 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
           count-test-failure
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
@@ -221,15 +216,13 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
           count-test-failure
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, g, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
           move-cursor-to-left-margin-of-next-line 0/screen
           break $check-screen-row-in-background-color-from:compare-graphemes
@@ -246,8 +239,7 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
           count-test-failure
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-grapheme-at-cursor-over-full-screen 0/screen, expected-grapheme, 3/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
           draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
           draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
diff --git a/apps/colors.mu b/apps/colors.mu
index 78e58838..c58fec35 100644
--- a/apps/colors.mu
+++ b/apps/colors.mu
@@ -28,8 +28,7 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
       var key2/eax: int <- copy key
       append-byte in, key2
       var g/eax: grapheme <- copy key2
-      draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
-      move-cursor-right 0
+      draw-grapheme-at-cursor-over-full-screen screen, g, 0xf/fg, 0/bg
       loop
     }
     clear-screen screen
diff --git a/apps/rpn.mu b/apps/rpn.mu
index 1f432365..ac54457d 100644
--- a/apps/rpn.mu
+++ b/apps/rpn.mu
@@ -36,12 +36,11 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
       var key2/eax: int <- copy key
       append-byte in, key2
       var g/eax: grapheme <- copy key2
-      draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
-      move-cursor-right 0
+      draw-grapheme-at-cursor-over-full-screen screen, g, 0xf/fg, 0/bg
       loop
     }
     # clear cursor
-    draw-grapheme-at-cursor screen, space, 3/fg/never-used, 0/bg
+    draw-grapheme-at-cursor-over-full-screen screen, space, 3/fg/never-used, 0/bg
     # parse and eval
     var out/eax: int <- simplify in
     # print
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index b806e0d2..eb752b14 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -242,8 +242,7 @@ fn render-empty-screen screen: (addr screen), _target-screen: (addr screen), xmi
     {
       compare x, *width
       break-if->=
-      draw-code-point-at-cursor screen, 0x20/space, 0x18/fg, 0/bg
-      move-cursor-right screen
+      draw-code-point-at-cursor-over-full-screen screen, 0x20/space, 0x18/fg, 0/bg
       x <- increment
       loop
     }
@@ -387,7 +386,7 @@ fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen
   var src-grapheme/eax: (addr grapheme) <- get src-cell, data
   var src-color/ecx: (addr int) <- get src-cell, color
   var src-background-color/edx: (addr int) <- get src-cell, background-color
-  draw-grapheme-at-cursor screen, *src-grapheme, *src-color, *src-background-color
+  draw-grapheme-at-cursor-over-full-screen screen, *src-grapheme, *src-color, *src-background-color
 }
 
 fn render-sandbox-edit-menu screen: (addr screen), _self: (addr sandbox) {