about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-12 02:05:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-12 02:05:38 -0700
commit20a48315723736e35f29694873adb762d76cbb82 (patch)
tree5821c94cc892c8627b712e8b2e30966644575fff
parent9aaed87f13a03ab8da6aa8950623416763dee665 (diff)
downloadmu-20a48315723736e35f29694873adb762d76cbb82.tar.gz
1979 - bug: couldn't edit sandboxes with prints
Thanks Jack and Caleb Couch.
-rw-r--r--edit.mu52
1 files changed, 48 insertions, 4 deletions
diff --git a/edit.mu b/edit.mu
index 4f127249..30e29e2d 100644
--- a/edit.mu
+++ b/edit.mu
@@ -4877,6 +4877,52 @@ scenario run-instruction-manages-screen-per-sandbox [
   ]
 ]
 
+scenario sandbox-with-print-can-be-edited [
+  $close-trace
+  assume-screen 100/width, 20/height
+  # left editor is empty
+  1:address:array:character <- new []
+  # right editor contains an instruction
+  2:address:array:character <- new [print-integer screen:address, 4]
+  3:address:programming-environment-data <- new-programming-environment screen:address, 1:address:array:character, 2:address:array:character
+  # run the sandbox
+  assume-console [
+    press 65532  # F4
+  ]
+  run [
+    event-loop screen:address, console:address, 3:address:programming-environment-data
+  ]
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .                                                  ┊                                                 .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
+    .                                                  ┊                                                x.
+    .                                                  ┊print-integer screen:address, 4                  .
+    .                                                  ┊screen:                                          .
+    .                                                  ┊  .4                             .               .
+    .                                                  ┊  .                              .               .
+    .                                                  ┊  .                              .               .
+    .                                                  ┊  .                              .               .
+    .                                                  ┊  .                              .               .
+    .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
+    .                                                  ┊                                                 .
+  ]
+  # edit the sandbox
+  assume-console [
+    left-click 3, 70
+  ]
+  run [
+    event-loop screen:address, console:address, 3:address:programming-environment-data
+  ]
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .                                                  ┊print-integer screen:address, 4                  .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
+    .                                                  ┊                                                 .
+    .                                                  ┊                                                 .
+  ]
+]
+
 recipe editor-contents [
   local-scope
   editor:address:editor-data <- next-ingredient
@@ -5256,11 +5302,9 @@ recipe find-click-in-sandbox-output [
   }
   # return sandbox if click is in its output region
   response-starting-row:number <- get *sandbox, response-starting-row-on-screen:offset
+  reply-unless response-starting-row, 0/no-click-in-sandbox-output
   click-in-response?:boolean <- greater-or-equal click-row, response-starting-row
-  {
-    break-if click-in-response?
-    reply 0/no-click-in-sandbox-output
-  }
+  reply-unless click-in-response?, 0/no-click-in-sandbox-output
   reply sandbox
 ]