diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-08-22 09:19:40 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-08-22 09:19:40 -0700 |
commit | fc97f6670d3094f1a5f213ec3a3f7134a14ddadd (patch) | |
tree | 0cf8373544ec02543ac5d89b1cc58cf28a6e1c0c | |
parent | 115c6080017e9fa4b47292b5f58fbcef26daf4c4 (diff) | |
download | mu-fc97f6670d3094f1a5f213ec3a3f7134a14ddadd.tar.gz |
3982 - bugfix: clear old recipe errors on F4
This regression was introduced by commit 3902 in June. Making this commit clean took the last 4 commits of reorganizing.
-rw-r--r-- | edit/005-sandbox.mu | 1 | ||||
-rw-r--r-- | edit/011-errors.mu | 59 |
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 |