From a12f77f36e5e88d55ebdde0a8ec6e4a6ca708394 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 25 Nov 2014 22:15:57 -0600 Subject: [PATCH] adjust changes in 8027e48 so that we see intermediate output during flushes instead of collecting the entire contents of the buffer before flushing (at least in the more common case) --- .../gui-lib/framework/private/text.rkt | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/pkgs/gui-pkgs/gui-lib/framework/private/text.rkt b/pkgs/gui-pkgs/gui-lib/framework/private/text.rkt index 24b58468d8..25aa9c4edc 100644 --- a/pkgs/gui-pkgs/gui-lib/framework/private/text.rkt +++ b/pkgs/gui-pkgs/gui-lib/framework/private/text.rkt @@ -2647,21 +2647,24 @@ (split-queue converter q)) (cond [flush-keep-trying? - (cons viable-bytes (loop next-remaining-queue))] + (cond + [(channel? return-evt/to-insert-chan) + (cons viable-bytes (loop next-remaining-queue))] + [else + (define c (make-channel)) + (queue-insertion viable-bytes c) + (channel-put c #f) + (loop next-remaining-queue)])] [else (set! remaining-queue next-remaining-queue) - (list viable-bytes)]))) - (cond - [(channel? return-evt/to-insert-chan) - (channel-put return-evt/to-insert-chan viable-bytess)] - [else - (let loop ([viable-bytess viable-bytess]) - (cond - [(null? (cdr viable-bytess)) - (queue-insertion (car viable-bytess) return-evt/to-insert-chan)] - [else - (queue-insertion (car viable-bytess) always-evt) - (loop (cdr viable-bytess))]))]) + (cond + [(channel? return-evt/to-insert-chan) + (list viable-bytes)] + [else + (queue-insertion viable-bytes return-evt/to-insert-chan) + #f])]))) + (when (channel? return-evt/to-insert-chan) + (channel-put return-evt/to-insert-chan viable-bytess)) (loop remaining-queue (current-inexact-milliseconds)))) (handle-evt clear-output-chan