diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-04-16 15:02:42 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-04-16 15:05:31 -0700 |
commit | ace7ffb714ce5314c665f28945ee0f3f1664f9ca (patch) | |
tree | 191088837e3a6c6fa6a38aae59431efa88c86cb9 /sandbox | |
parent | ef73b04e744a69973208096a49d4ae52ddbb84d2 (diff) | |
download | mu-ace7ffb714ce5314c665f28945ee0f3f1664f9ca.tar.gz |
3824 - experiment: stop buffering in termbox
Now it's much more apparent why things are slow. You can see each repaint happening. Already I fixed one performance bug -- in clear-rest-of-screen. Since this subverts Mu's fake screen there may be bugs. Another salubrious side effect: I've finally internalized that switching to raw mode doesn't have to clear the screen. That was just an artifact of how termbox abstracted operations. Now I can conceive of using termbox to build a repl as well. (I was inspired to poke into termbox internals by http://viewsourcecode.org/snaptoken/kilo and https://github.com/antirez/linenoise)
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/001-editor.mu | 2 | ||||
-rw-r--r-- | sandbox/004-programming-environment.mu | 17 | ||||
-rw-r--r-- | sandbox/005-sandbox.mu | 4 | ||||
-rw-r--r-- | sandbox/006-sandbox-copy.mu | 2 | ||||
-rw-r--r-- | sandbox/007-sandbox-delete.mu | 2 | ||||
-rw-r--r-- | sandbox/008-sandbox-edit.mu | 2 | ||||
-rw-r--r-- | sandbox/009-sandbox-test.mu | 3 | ||||
-rw-r--r-- | sandbox/010-sandbox-trace.mu | 3 |
8 files changed, 0 insertions, 35 deletions
diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu index 60042344..717e147c 100644 --- a/sandbox/001-editor.mu +++ b/sandbox/001-editor.mu @@ -6,10 +6,8 @@ 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/004-programming-environment.mu b/sandbox/004-programming-environment.mu index 79fa79c6..7f0b4a05 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -89,7 +89,6 @@ 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 render?:bool <- handle-keyboard-event screen, current-sandbox, e:event # refresh screen only if no more events # if there are more events to process, wait for them to clear up, then make sure you render-all afterward. @@ -117,7 +116,6 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: } +finish-event screen <- update-cursor screen, current-sandbox, env - show-screen screen } loop } @@ -223,7 +221,6 @@ 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 @@ -239,8 +236,6 @@ 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 @@ -267,15 +262,3 @@ 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 badd0d46..91826802 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -793,9 +793,7 @@ 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 - show-screen screen jump +finish-event } ] @@ -822,9 +820,7 @@ 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 - show-screen screen jump +finish-event } ] diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu index 995f4c7c..4835f02e 100644 --- a/sandbox/006-sandbox-copy.mu +++ b/sandbox/006-sandbox-copy.mu @@ -140,10 +140,8 @@ 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 ddfbf692..107c861c 100644 --- a/sandbox/007-sandbox-delete.mu +++ b/sandbox/007-sandbox-delete.mu @@ -69,10 +69,8 @@ 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 cb19ebc4..ec4fd578 100644 --- a/sandbox/008-sandbox-edit.mu +++ b/sandbox/008-sandbox-edit.mu @@ -111,10 +111,8 @@ 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 2ee45a1e..1c24bcb8 100644 --- a/sandbox/009-sandbox-test.mu +++ b/sandbox/009-sandbox-test.mu @@ -132,11 +132,8 @@ 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 - # no change in cursor - show-screen screen loop +next-event } ] diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu index 72f6fe03..27f2915a 100644 --- a/sandbox/010-sandbox-trace.mu +++ b/sandbox/010-sandbox-trace.mu @@ -190,11 +190,8 @@ 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 - # no change in cursor - show-screen screen loop +next-event } ] |