diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-13 12:42:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-13 12:42:17 -0700 |
commit | 0c0d1ea5cdb96a98e7eb62edbd1acb534ae12940 (patch) | |
tree | 7b64a6e98fb16d2bf02c5003acc2c14d7d1d6043 /edit | |
parent | 8195ed4ee94f490d377b91caa0d79f21dd3e86ed (diff) | |
download | mu-0c0d1ea5cdb96a98e7eb62edbd1acb534ae12940.tar.gz |
3854
Revert commits 3824, 3850 and 3852. We'll redo them more carefully.
Diffstat (limited to 'edit')
-rw-r--r-- | edit/001-editor.mu | 2 | ||||
-rw-r--r-- | edit/002-typing.mu | 7 | ||||
-rw-r--r-- | edit/004-programming-environment.mu | 31 | ||||
-rw-r--r-- | edit/005-sandbox.mu | 27 | ||||
-rw-r--r-- | edit/006-sandbox-copy.mu | 2 | ||||
-rw-r--r-- | edit/007-sandbox-delete.mu | 2 | ||||
-rw-r--r-- | edit/008-sandbox-edit.mu | 2 | ||||
-rw-r--r-- | edit/009-sandbox-test.mu | 2 | ||||
-rw-r--r-- | edit/010-sandbox-trace.mu | 2 |
9 files changed, 35 insertions, 42 deletions
diff --git a/edit/001-editor.mu b/edit/001-editor.mu index a6dde85b..d81278ae 100644 --- a/edit/001-editor.mu +++ b/edit/001-editor.mu @@ -6,8 +6,10 @@ def main text:text [ local-scope load-ingredients open-console + hide-screen 0/screen e:&:editor <- new-editor text, 0/left, 5/right render 0/screen, e + show-screen 0/screen wait-for-event 0/console close-console ] diff --git a/edit/002-typing.mu b/edit/002-typing.mu index d5120f2f..4f704f0d 100644 --- a/edit/002-typing.mu +++ b/edit/002-typing.mu @@ -266,17 +266,10 @@ def editor-render screen:&:screen, editor:&:editor -> screen:&:screen, editor:&: left:num <- get *editor, left:offset right:num <- get *editor, right:offset row:num, column:num <- render screen, editor - screen-height:num <- screen-height screen - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? clear-line-until screen, right row <- add row, 1 - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? draw-horizontal screen, row, left, right, 9480/horizontal-dotted row <- add row, 1 - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? clear-screen-from screen, row, left, left, right ] diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index ba626cb4..597e6900 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -96,6 +96,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: } # if it's not global and not a touch event, send to appropriate editor { + hide-screen screen sandbox-in-focus?:bool <- get *env, sandbox-in-focus?:offset { break-if sandbox-in-focus? @@ -115,6 +116,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: screen <- render-all screen, env, render } screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen } loop } @@ -393,6 +395,7 @@ def render-all screen:&:screen, env:&:environment, {render-editor: (recipe (addr local-scope load-ingredients trace 10, [app], [render all] + hide-screen screen # top menu trace 11, [app], [render top menu] width:num <- screen-width screen @@ -416,6 +419,8 @@ def render-all screen:&:screen, env:&:environment, {render-editor: (recipe (addr current-sandbox:&:editor <- get *env, current-sandbox:offset sandbox-in-focus?:bool <- get *env, sandbox-in-focus?:offset screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + # + show-screen screen ] def render-recipes screen:&:screen, env:&:environment, {render-editor: (recipe (address screen) (address editor) -> number number (address screen) (address editor))} -> screen:&:screen, env:&:environment [ @@ -427,19 +432,12 @@ def render-recipes screen:&:screen, env:&:environment, {render-editor: (recipe ( left:num <- get *recipes, left:offset right:num <- get *recipes, right:offset row:num, column:num, screen <- call render-editor, screen, recipes - screen-height:num <- screen-height screen - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? clear-line-until screen, right row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? <render-recipe-components-end> # draw dotted line after recipes draw-horizontal screen, row, left, right, 9480/horizontal-dotted row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? clear-screen-from screen, row, left, left, right ] @@ -451,18 +449,11 @@ def render-sandbox-side screen:&:screen, env:&:environment, {render-editor: (rec left:num <- get *current-sandbox, left:offset right:num <- get *current-sandbox, right:offset row:num, column:num, screen, current-sandbox <- call render-editor, screen, current-sandbox - screen-height:num <- screen-height screen - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? clear-line-until screen, right row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? # draw solid line after code (you'll see why in later layers) draw-horizontal screen, row, left, right row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? clear-screen-from screen, row, left, left, right ] @@ -483,6 +474,18 @@ def update-cursor screen:&:screen, recipes:&:editor, current-sandbox:&:editor, s screen <- move-cursor screen, cursor-row, cursor-column ] +# ctrl-l - redraw screen (just in case it printed junk somehow) + +after <global-type> [ + { + redraw-screen?:bool <- equal c, 12/ctrl-l + break-unless redraw-screen? + screen <- render-all screen, env:&:environment, render + sync-screen screen + loop +next-event + } +] + # ctrl-n - switch focus # todo: test this diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index fed2c806..5f08554d 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -245,26 +245,19 @@ def! render-sandbox-side screen:&:screen, env:&:environment, {render-editor: (re row:num, column:num <- copy 1, 0 left:num <- get *current-sandbox, left:offset right:num <- get *current-sandbox, right:offset - screen-height:num <- screen-height screen # render sandbox editor render-from:num <- get *env, render-from:offset { render-current-sandbox?:bool <- equal render-from, -1 break-unless render-current-sandbox? row, column, screen, current-sandbox <- call render-editor, screen, current-sandbox - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? clear-screen-from screen, row, column, left, right row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? } # render sandboxes draw-horizontal screen, row, left, right sandbox:&:sandbox <- get *env, sandbox:offset row, screen <- render-sandboxes screen, sandbox, left, right, row, render-from - space-left? <- lesser-than row, screen-height - return-unless space-left? clear-rest-of-screen screen, row, left, right ] @@ -280,22 +273,16 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro break-if hidden? # render sandbox menu row <- add row, 1 - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? screen <- move-cursor screen, row, left screen <- render-sandbox-menu screen, idx, left, right # save menu row so we can detect clicks to it later *sandbox <- put *sandbox, starting-row-on-screen:offset, row # render sandbox contents row <- add row, 1 - space-left? <- lesser-than row, screen-height - return-unless space-left? screen <- move-cursor screen, row, left sandbox-data:text <- get *sandbox, data:offset row, screen <- render-code screen, sandbox-data, left, right, row *sandbox <- put *sandbox, code-ending-row-on-screen:offset, row - space-left? <- lesser-than row, screen-height - return-unless space-left? # render sandbox warnings, screen or response, in that order sandbox-response:text <- get *sandbox, response:offset <render-sandbox-results> @@ -311,8 +298,8 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro row, screen <- render-text screen, sandbox-response, left, right, 245/grey, row } +render-sandbox-end - space-left? <- lesser-than row, screen-height - return-unless space-left? + at-bottom?:bool <- greater-or-equal row, screen-height + return-if at-bottom? # draw solid line after sandbox draw-horizontal screen, row, left, right } @@ -324,8 +311,6 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro <end-render-sandbox-reset-hidden> } # draw next sandbox - space-left? <- lesser-than row, screen-height - return-unless space-left? next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset next-idx:num <- add idx, 1 row, screen <- render-sandboxes screen, next-sandbox, left, right, row, render-from, next-idx @@ -426,8 +411,6 @@ def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num column <- add column, 1 loop } - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? was-at-left?:bool <- equal column, left clear-line-until screen, right { @@ -508,8 +491,6 @@ def render-code screen:&:screen, s:text, left:num, right:num, row:num -> row:num column <- add column, 1 loop } - space-left?:bool <- lesser-than row, screen-height - return-unless space-left? was-at-left?:bool <- equal column, left clear-line-until screen, right { @@ -990,8 +971,10 @@ after <global-keypress> [ render-from <- add render-from, 1 *env <- put *env, render-from:offset, render-from } + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] @@ -1020,8 +1003,10 @@ after <global-keypress> [ break-if at-beginning? render-from <- subtract render-from, 1 *env <- put *env, render-from:offset, render-from + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] diff --git a/edit/006-sandbox-copy.mu b/edit/006-sandbox-copy.mu index d3f82e88..9df5e625 100644 --- a/edit/006-sandbox-copy.mu +++ b/edit/006-sandbox-copy.mu @@ -128,8 +128,10 @@ after <global-touch> [ break-unless copy? copy?, env <- try-copy-sandbox click-row, env break-unless copy? + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] diff --git a/edit/007-sandbox-delete.mu b/edit/007-sandbox-delete.mu index 5167b038..4fa3c37d 100644 --- a/edit/007-sandbox-delete.mu +++ b/edit/007-sandbox-delete.mu @@ -72,8 +72,10 @@ after <global-touch> [ break-unless delete? delete?, env <- try-delete-sandbox click-row, env break-unless delete? + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] diff --git a/edit/008-sandbox-edit.mu b/edit/008-sandbox-edit.mu index 2d591ad6..dd5c1bb9 100644 --- a/edit/008-sandbox-edit.mu +++ b/edit/008-sandbox-edit.mu @@ -111,8 +111,10 @@ after <global-touch> [ break-unless edit? edit?, env <- try-edit-sandbox click-row, env break-unless edit? + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu index badd795b..023015ed 100644 --- a/edit/009-sandbox-test.mu +++ b/edit/009-sandbox-test.mu @@ -130,8 +130,10 @@ after <global-touch> [ # toggle its expected-response, and save session sandbox <- toggle-expected-response sandbox save-sandboxes env, resources + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] diff --git a/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu index 8088577a..66a321d6 100644 --- a/edit/010-sandbox-trace.mu +++ b/edit/010-sandbox-trace.mu @@ -200,8 +200,10 @@ after <global-touch> [ x:bool <- get *sandbox, display-trace?:offset x <- not x *sandbox <- put *sandbox, display-trace?:offset, x + hide-screen screen screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen loop +next-event } ] |