about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-13 12:42:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-13 12:42:17 -0700
commit0c0d1ea5cdb96a98e7eb62edbd1acb534ae12940 (patch)
tree7b64a6e98fb16d2bf02c5003acc2c14d7d1d6043 /sandbox
parent8195ed4ee94f490d377b91caa0d79f21dd3e86ed (diff)
downloadmu-0c0d1ea5cdb96a98e7eb62edbd1acb534ae12940.tar.gz
3854
Revert commits 3824, 3850 and 3852. We'll redo them more carefully.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/001-editor.mu2
-rw-r--r--sandbox/002-typing.mu7
-rw-r--r--sandbox/004-programming-environment.mu26
-rw-r--r--sandbox/005-sandbox.mu33
-rw-r--r--sandbox/006-sandbox-copy.mu2
-rw-r--r--sandbox/007-sandbox-delete.mu2
-rw-r--r--sandbox/008-sandbox-edit.mu2
-rw-r--r--sandbox/009-sandbox-test.mu2
-rw-r--r--sandbox/010-sandbox-trace.mu2
9 files changed, 39 insertions, 39 deletions
diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu
index a6dde85b..d81278ae 100644
--- a/sandbox/001-editor.mu
+++ b/sandbox/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/sandbox/002-typing.mu b/sandbox/002-typing.mu
index d5120f2f..4f704f0d 100644
--- a/sandbox/002-typing.mu
+++ b/sandbox/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/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu
index 2dca181d..917ea957 100644
--- a/sandbox/004-programming-environment.mu
+++ b/sandbox/004-programming-environment.mu
@@ -79,6 +79,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources:
     }
     # not global and not a touch event
     {
+      hide-screen screen
       render?:bool <- handle-keyboard-event screen, current-sandbox, e:event
       break-unless render?
       # try to batch up rendering if there are more events queued up
@@ -89,6 +90,9 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources:
         break-unless render-all-on-no-more-events?
         screen <- render-all screen, env, render
       }
+      +finish-event
+      screen <- update-cursor screen, current-sandbox, env
+      show-screen screen
     }
     loop
   }
@@ -194,6 +198,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
@@ -209,6 +214,8 @@ def render-all screen:&:screen, env:&:environment, {render-editor: (recipe (addr
   #
   current-sandbox:&:editor <- get *env, current-sandbox:offset
   screen <- update-cursor screen, current-sandbox, env
+  #
+  show-screen screen
 ]
 
 # replaced in a later layer
@@ -219,18 +226,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
 ]
 
@@ -242,3 +242,15 @@ def update-cursor screen:&:screen, current-sandbox:&:editor, env:&:environment -
   cursor-column:num <- get *current-sandbox, cursor-column:offset
   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
+  }
+]
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index 06262d72..e9500797 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -234,26 +234,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, 0, env
-  space-left? <- lesser-than row, screen-height
-  return-unless space-left?
   clear-rest-of-screen screen, row, left, right
 ]
 
@@ -270,22 +263,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>
@@ -301,8 +288,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
   }
@@ -314,8 +301,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, env
@@ -416,8 +401,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
   {
@@ -483,8 +466,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
   {
@@ -812,9 +793,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, current-sandbox, env
-    loop +next-event
+    show-screen screen
+    jump +finish-event
   }
 ]
 
@@ -840,9 +822,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, current-sandbox, env
-    loop +next-event
+    show-screen screen
+    jump +finish-event
   }
 ]
 
diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu
index 4835f02e..995f4c7c 100644
--- a/sandbox/006-sandbox-copy.mu
+++ b/sandbox/006-sandbox-copy.mu
@@ -140,8 +140,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, current-sandbox, env
+    show-screen screen
     loop +next-event
   }
 ]
diff --git a/sandbox/007-sandbox-delete.mu b/sandbox/007-sandbox-delete.mu
index 107c861c..ddfbf692 100644
--- a/sandbox/007-sandbox-delete.mu
+++ b/sandbox/007-sandbox-delete.mu
@@ -69,8 +69,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, current-sandbox, env
+    show-screen screen
     loop +next-event
   }
 ]
diff --git a/sandbox/008-sandbox-edit.mu b/sandbox/008-sandbox-edit.mu
index ec4fd578..cb19ebc4 100644
--- a/sandbox/008-sandbox-edit.mu
+++ b/sandbox/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, current-sandbox, env
+    show-screen screen
     loop +next-event
   }
 ]
diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu
index 1c24bcb8..d7b8ed62 100644
--- a/sandbox/009-sandbox-test.mu
+++ b/sandbox/009-sandbox-test.mu
@@ -132,8 +132,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, current-sandbox, env
+    show-screen screen
     loop +next-event
   }
 ]
diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu
index 27f2915a..f81d4151 100644
--- a/sandbox/010-sandbox-trace.mu
+++ b/sandbox/010-sandbox-trace.mu
@@ -190,8 +190,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, current-sandbox, env
+    show-screen screen
     loop +next-event
   }
 ]