about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-27 18:33:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-27 18:38:04 -0700
commitd4ccdfb829a859a1739836b2e36786a6756edead (patch)
tree886d538749b29c25dee5ba239b3e5edb9ff57f35
parentb2c86f7a6252d8183462cddc51b8cde28ab49250 (diff)
downloadmu-d4ccdfb829a859a1739836b2e36786a6756edead.tar.gz
1492
-rw-r--r--repl.mu25
1 files changed, 24 insertions, 1 deletions
diff --git a/repl.mu b/repl.mu
index 4f86caf2..eb0d7263 100644
--- a/repl.mu
+++ b/repl.mu
@@ -85,7 +85,7 @@ recipe read-instruction [
 #?       $print [decremented to ], current-color-count:number, [ 
 #? ] #? 1
       {
-        reset-color?:boolean <- lesser-or-equal current-color-count:number, 1:literal  # last key we're about to backspace over in this iteration
+        reset-color?:boolean <- lesser-or-equal current-color-count:number, 0:literal
         break-unless reset-color?:boolean
 #?         $print [resetting color
 #?   ] #? 1
@@ -175,3 +175,26 @@ scenario read-instruction-cancel-comment-on-backspace2 [
     .                              .
   ]
 ]
+
+scenario read-instruction-cancel-comment-on-backspace3 [
+  assume-screen 30:literal/width, 5:literal/height
+  assume-keyboard [#a<z
+]
+  # setup: replace '<'s with backspace key since we can't represent backspace in strings
+  run [
+    buf:address:array:character <- get keyboard:address:keyboard/deref, data:offset
+    first:address:character <- index-address buf:address:array:character/deref, 2:literal
+    first:address:character/deref <- copy 8:literal/backspace
+  ]
+  run [
+    read-instruction keyboard:address, screen:address
+  ]
+  screen-should-contain-in-color 4:literal/blue, [
+    .#z                            .
+    .                              .
+  ]
+  screen-should-contain-in-color 7:literal/white, [
+    .                              .
+    .                              .
+  ]
+]