about summary refs log tree commit diff stats
path: root/sandbox/004-programming-environment.mu
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/004-programming-environment.mu
parent8195ed4ee94f490d377b91caa0d79f21dd3e86ed (diff)
downloadmu-0c0d1ea5cdb96a98e7eb62edbd1acb534ae12940.tar.gz
3854
Revert commits 3824, 3850 and 3852. We'll redo them more carefully.
Diffstat (limited to 'sandbox/004-programming-environment.mu')
-rw-r--r--sandbox/004-programming-environment.mu26
1 files changed, 19 insertions, 7 deletions
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
+  }
+]