about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--edit/005-sandbox.mu1
-rw-r--r--edit/011-errors.mu59
2 files changed, 60 insertions, 0 deletions
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 16754946..869b4ca4 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -129,6 +129,7 @@ after <global-keypress> [
     do-run?:bool <- equal k, 65532/F4
     break-unless do-run?
     screen <- update-status screen, [running...       ], 245/grey
+    <begin-run-sandboxes-on-F4>
     error?:bool <- run-sandboxes env, resources, screen
     # we could just render-all, but we do some work to minimize the number of prints to screen
     <end-run-sandboxes-on-F4>
diff --git a/edit/011-errors.mu b/edit/011-errors.mu
index 9625f8e1..8db2c583 100644
--- a/edit/011-errors.mu
+++ b/edit/011-errors.mu
@@ -23,7 +23,15 @@ def! update-recipes env:&:environment, resources:&:resources, screen:&:screen ->
   errors-found? <- copy 0/false
 ]
 
+after <begin-run-sandboxes-on-F4> [
+  old-recipe-errors:text <- get *env, recipe-errors:offset
+]
 before <end-run-sandboxes-on-F4> [
+  # if there were recipe errors before, check if we can clear them
+  {
+    break-unless old-recipe-errors
+    screen <- render-recipes screen, env, render
+  }
   screen <- render-recipe-errors env, screen
 ]
 
@@ -562,6 +570,57 @@ scenario run-shows-errors-every-time [
   ]
 ]
 
+scenario run-hides-errors [
+  local-scope
+  trace-until 100/app  # trace too long
+  assume-screen 100/width, 15/height
+  # try to run a file with an error
+  assume-resources [
+    [lesson/recipes.mu] <- [
+      |recipe foo [|
+      |  local-scope|
+      |  x:num <- copy y:num|
+      |]|
+    ]
+  ]
+  env:&:environment <- new-programming-environment resources, screen, [foo]
+  render-all screen, env, render
+  assume-console [
+    press F4
+  ]
+  event-loop screen, console, env, resources
+  screen-should-contain [
+    .  errors found                                                                   run (F4)           .
+    .recipe foo [                                      ┊foo                                              .
+    .  local-scope                                     ┊─────────────────────────────────────────────────.
+    .  x:num <- copy y:num                             ┊                                                 .
+    .]                                                 ┊                                                 .
+    .foo: tried to read ingredient 'y' in 'x:num <- co↩┊                                                 .
+    .py y:num' but it hasn't been written to yet       ┊                                                 .
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .
+    .                                                  ┊                                                 .
+  ]
+  # fix the error, hit F4
+  assume-console [
+    left-click 3, 16
+    press ctrl-k
+    type [0]
+    press F4
+  ]
+  event-loop screen, console, env, resources
+  # no error anymore
+  screen-should-contain [
+    .                                                                                 run (F4)           .
+    .recipe foo [                                      ┊                                                 .
+    .  local-scope                                     ┊─────────────────────────────────────────────────.
+    .  x:num <- copy 0                                 ┊0   edit       copy       to recipe    delete    .
+    .]                                                 ┊foo                                              .
+    .                                                  ┊─────────────────────────────────────────────────.
+    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .
+    .                                                  ┊                                                 .
+  ]
+]
+
 scenario run-instruction-and-print-errors [
   local-scope
   trace-until 100/app  # trace too long