about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-06 14:54:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-06 14:54:26 -0700
commitdc0e767cf5130461a6aa58774d1016ec3934396b (patch)
treecd4522ac4fb08a2679f663b813dd2e62f7332fb4 /edit
parent71d4ce1800b5df555aa7786b30f4d5d7fcd30352 (diff)
downloadmu-dc0e767cf5130461a6aa58774d1016ec3934396b.tar.gz
3844
Once I start optimizing most events to not repaint everything there's no
need to be smart about queued-up events.
Diffstat (limited to 'edit')
-rw-r--r--edit/004-programming-environment.mu63
1 files changed, 5 insertions, 58 deletions
diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu
index 78264212..435495f4 100644
--- a/edit/004-programming-environment.mu
+++ b/edit/004-programming-environment.mu
@@ -42,10 +42,6 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources:
   recipes:&:editor <- get *env, recipes:offset
   current-sandbox:&:editor <- get *env, current-sandbox:offset
   sandbox-in-focus?:bool <- get *env, sandbox-in-focus?:offset
-  # if we fall behind we'll stop updating the screen, but then we have to
-  # render the entire screen when we catch up.
-  # todo: test this
-  render-all-on-no-more-events?:bool <- copy 0/false
   {
     # looping over each (keyboard or touch) event as it occurs
     +next-event
@@ -100,65 +96,16 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources:
       {
         break-if sandbox-in-focus?
         render?:bool <- handle-keyboard-event screen, recipes, 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.
-        more-events?:bool <- has-more-events? console
-        {
-          break-unless more-events?
-          render-all-on-no-more-events? <- copy 1/true  # no rendering now, full rendering on some future event
-          screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
-          loop +next-event
-        }
-        {
-          break-if more-events?
-          {
-            break-unless render-all-on-no-more-events?
-            # no more events, and we have to force render
-            screen <- render-all screen, env, render
-            render-all-on-no-more-events? <- copy 0/false
-            loop +next-event
-          }
-          # no more events, no force render
-          {
-            break-unless render?
-            screen <- render-recipes screen, env, render
-            screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
-            loop +next-event
-          }
-        }
-        screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
+        break-unless render?
+        screen <- render-all screen, env, render
       }
       {
         break-unless sandbox-in-focus?
         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.
-        more-events?:bool <- has-more-events? console
-        {
-          break-unless more-events?
-          render-all-on-no-more-events? <- copy 1/true  # no rendering now, full rendering on some future event
-          screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
-          loop +next-event
-        }
-        {
-          break-if more-events?
-          {
-            break-unless render-all-on-no-more-events?
-            # no more events, and we have to force render
-            screen <- render-all screen, env, render
-            render-all-on-no-more-events? <- copy 0/false
-            loop +next-event
-          }
-          # no more events, no force render
-          {
-            break-unless render?
-            screen <- render-sandbox-side screen, env, render
-            screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
-            loop +next-event
-          }
-          screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
-        }
+        break-unless render?
+        screen <- render-sandbox-side screen, env, render
       }
+      screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
     }
     loop
   }
'#n294'>294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423