diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-06-09 11:29:15 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-06-09 11:29:15 -0700 |
commit | 6d12a8c4ebe25527c92a934702e2628ce8c4bd4c (patch) | |
tree | 051825d9664a06fc3bc7085031fe62dfeb94c417 /edit | |
parent | f53746f80145a184b5e4a6974175e2f92f49dcba (diff) | |
download | mu-6d12a8c4ebe25527c92a934702e2628ce8c4bd4c.tar.gz |
3902 - drop redundant redraw of recipe side on F4
This change is interesting because I only updated one test to gain confidence that F4 will never redraw the recipe side. (Most of the changes are to explicitly render-all before each scenario.)
Diffstat (limited to 'edit')
-rw-r--r-- | edit/004-programming-environment.mu | 1 | ||||
-rw-r--r-- | edit/005-sandbox.mu | 17 | ||||
-rw-r--r-- | edit/006-sandbox-copy.mu | 4 | ||||
-rw-r--r-- | edit/007-sandbox-delete.mu | 1 | ||||
-rw-r--r-- | edit/008-sandbox-edit.mu | 3 | ||||
-rw-r--r-- | edit/009-sandbox-test.mu | 1 | ||||
-rw-r--r-- | edit/010-sandbox-trace.mu | 3 | ||||
-rw-r--r-- | edit/011-errors.mu | 35 |
8 files changed, 52 insertions, 13 deletions
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index 55fd23f9..f0c8501e 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -451,6 +451,7 @@ def render-recipes screen:&:screen, env:&:environment, {render-editor: (recipe ( def render-sandbox-side screen:&:screen, env:&:environment, {render-editor: (recipe (address screen) (address editor) -> number number (address screen) (address editor))} -> screen:&:screen, env:&:environment [ local-scope load-ingredients + trace 11, [app], [render sandboxes] current-sandbox:&:editor <- get *env, current-sandbox:offset left:num <- get *current-sandbox, left:offset right:num <- get *current-sandbox, right:offset diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 8db55206..caa3e6e6 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -47,6 +47,7 @@ scenario run-and-show-results [ ] # sandbox editor contains an instruction without storing outputs env:&:environment <- new-programming-environment resources, screen, [divide-with-remainder 11, 3] + render-all screen, env, render # run the code in the editors assume-console [ press F4 @@ -129,12 +130,17 @@ after <global-keypress> [ break-unless do-run? screen <- update-status screen, [running... ], 245/grey error?:bool <- run-sandboxes env, resources, screen - # F4 might update warnings and results on both sides - screen <- render-all screen, env, render + # we could just render-all, but we do some work to minimize the number of prints to screen + <render-recipe-errors-on-F4> + screen <- render-sandbox-side screen, env, render { break-if error? screen <- update-status screen, [ ], 245/grey } + { + break-unless error? + <render-sandbox-errors-on-F4> + } screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env loop +next-event } @@ -551,6 +557,8 @@ scenario run-updates-results [ ] # sandbox editor contains an instruction without storing outputs env:&:environment <- new-programming-environment resources, screen, [foo] # contents of sandbox editor + render-all screen, env, render + $clear-trace # run the code in the editors assume-console [ press F4 @@ -568,6 +576,10 @@ scenario run-updates-results [ .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . . ┊ . ] + # no need to update editor + trace-should-not-contain [ + app: render recipes + ] # make a change (incrementing one of the args to 'add'), then rerun assume-console [ left-click 4, 28 # one past the value of the second arg @@ -602,6 +614,7 @@ scenario run-instruction-manages-screen-per-sandbox [ ] # sandbox editor contains an instruction env:&:environment <- new-programming-environment resources, screen, [print screen, 4] # contents of sandbox editor + render-all screen, env, render # run the code in the editor assume-console [ press F4 diff --git a/edit/006-sandbox-copy.mu b/edit/006-sandbox-copy.mu index 4512afaf..ef9bed24 100644 --- a/edit/006-sandbox-copy.mu +++ b/edit/006-sandbox-copy.mu @@ -9,6 +9,7 @@ scenario copy-a-sandbox-to-editor [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 1, 1] # contents of sandbox editor + render-all screen, env, render # run it assume-console [ press F4 @@ -69,6 +70,7 @@ scenario copy-a-sandbox-to-editor-2 [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 1, 1] # contents of sandbox editor + render-all screen, env, render # run it assume-console [ press F4 @@ -222,6 +224,7 @@ scenario copy-fails-if-sandbox-editor-not-empty [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 1, 1] # contents of sandbox editor + render-all screen, env, render # run it assume-console [ press F4 @@ -286,6 +289,7 @@ scenario copy-a-sandbox-to-recipe-side [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 1, 1] # contents of sandbox editor + render-all screen, env, render # run it assume-console [ press F4 diff --git a/edit/007-sandbox-delete.mu b/edit/007-sandbox-delete.mu index 4e10aa42..2db88964 100644 --- a/edit/007-sandbox-delete.mu +++ b/edit/007-sandbox-delete.mu @@ -7,6 +7,7 @@ scenario deleting-sandboxes [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] + render-all screen, env, render # run a few commands assume-console [ left-click 1, 75 diff --git a/edit/008-sandbox-edit.mu b/edit/008-sandbox-edit.mu index 9a2b0e7a..eeb0cd69 100644 --- a/edit/008-sandbox-edit.mu +++ b/edit/008-sandbox-edit.mu @@ -8,6 +8,7 @@ scenario clicking-on-sandbox-edit-button-moves-it-to-editor [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 2, 2] + render-all screen, env, render # run it assume-console [ press F4 @@ -60,6 +61,7 @@ scenario clicking-on-sandbox-edit-button-moves-it-to-editor-2 [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 2, 2] + render-all screen, env, render # run it assume-console [ press F4 @@ -164,6 +166,7 @@ scenario sandbox-with-print-can-be-edited [ ] # right editor contains a print instruction env:&:environment <- new-programming-environment resources, screen, [print screen, 4] + render-all screen, env, render # run the sandbox assume-console [ press F4 diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu index cccee3e0..f0ec9cc9 100644 --- a/edit/009-sandbox-test.mu +++ b/edit/009-sandbox-test.mu @@ -13,6 +13,7 @@ scenario sandbox-click-on-result-toggles-color-to-green [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render # run it assume-console [ press F4 diff --git a/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu index 2c136587..2d681b8f 100644 --- a/edit/010-sandbox-trace.mu +++ b/edit/010-sandbox-trace.mu @@ -13,6 +13,7 @@ scenario sandbox-click-on-code-toggles-app-trace [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render # run it assume-console [ press F4 @@ -87,6 +88,7 @@ scenario sandbox-shows-app-trace-and-result [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render # run it assume-console [ press F4 @@ -131,6 +133,7 @@ scenario clicking-on-app-trace-does-nothing [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [stash 123456789] + render-all screen, env, render # create and expand the trace assume-console [ press F4 diff --git a/edit/011-errors.mu b/edit/011-errors.mu index 8c423106..cf12f1c1 100644 --- a/edit/011-errors.mu +++ b/edit/011-errors.mu @@ -23,20 +23,19 @@ def! update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found? <- copy 0/false ] -before <render-components-end> [ - trace 11, [app], [render status] - recipe-errors:text <- get *env, recipe-errors:offset - { - break-unless recipe-errors - update-status screen, [errors found ], 1/red - } -] - -before <render-recipe-components-end> [ +after <render-recipe-errors-on-F4> [ { recipe-errors:text <- get *env, recipe-errors:offset break-unless recipe-errors + recipes:&:editor <- get *env, recipes:offset + left:num <- get *recipes, left:offset + right:num <- get *recipes, right:offset + row:num <- get *env, recipe-bottom:offset row, screen <- render-text screen, recipe-errors, left, right, 1/red, row + # draw dotted line after recipes + draw-horizontal screen, row, left, right, 9480/horizontal-dotted + row <- add row, 1 + clear-screen-from screen, row, left, left, right } ] @@ -61,7 +60,7 @@ before <run-sandboxes-end> [ } ] -before <render-components-end> [ +after <render-sandbox-errors-on-F4> [ { break-if recipe-errors error-index:num <- get *env, error-index:offset @@ -174,6 +173,7 @@ scenario run-updates-status-with-first-erroneous-sandbox [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] + render-all screen, env, render assume-console [ left-click 3, 80 # create invalid sandbox 1 @@ -199,6 +199,7 @@ scenario run-updates-status-with-first-erroneous-sandbox-2 [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [] + render-all screen, env, render assume-console [ left-click 3, 80 # create invalid sandbox 2 @@ -227,6 +228,7 @@ scenario run-hides-errors-from-past-sandboxes [ assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [get foo, x:offset] # invalid + render-all screen, env, render assume-console [ press F4 # generate error ] @@ -269,6 +271,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo 2] + render-all screen, env, render assume-console [ press F4 ] @@ -322,6 +325,7 @@ scenario run-avoids-spurious-errors-on-reloading-shape-shifting-recipes [ test-sandbox:text <- new [x:&:list:num <- copy 0 to-text x] env:&:environment <- new-programming-environment resources, screen, test-sandbox + render-all screen, env, render # run it once assume-console [ press F4 @@ -384,6 +388,7 @@ scenario run-shows-missing-type-errors [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render assume-console [ press F4 ] @@ -415,6 +420,7 @@ scenario run-shows-unbalanced-bracket-errors [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render assume-console [ press F4 ] @@ -446,6 +452,7 @@ scenario run-shows-get-on-non-container-errors [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render assume-console [ press F4 ] @@ -482,6 +489,7 @@ scenario run-shows-non-literal-get-argument-errors [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render assume-console [ press F4 ] @@ -518,6 +526,7 @@ scenario run-shows-errors-everytime [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render assume-console [ press F4 ] @@ -563,6 +572,7 @@ scenario run-instruction-and-print-errors [ ] # sandbox editor contains an illegal instruction env:&:environment <- new-programming-environment resources, screen, [get 1234:num, foo:offset] + render-all screen, env, render assume-console [ press F4 ] @@ -625,6 +635,7 @@ scenario run-instruction-and-print-errors-only-once [ ] # sandbox editor contains an illegal instruction env:&:environment <- new-programming-environment resources, screen, [get 1234:num, foo:offset] + render-all screen, env, render # run the code in the editors multiple times assume-console [ press F4 @@ -663,6 +674,7 @@ scenario sandbox-can-handle-infinite-loop [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo] + render-all screen, env, render # run the sandbox assume-console [ press F4 @@ -701,6 +713,7 @@ scenario sandbox-with-errors-shows-trace [ ] ] env:&:environment <- new-programming-environment resources, screen, [foo 4, 0] + render-all screen, env, render # run assume-console [ press F4 |