|
196 | 196 | (while (B.inkey :timeout 0)) |
197 | 197 | (B.inkey :esc-delay .01)) |
198 | 198 |
|
| 199 | +(defn print-full-screen [#* output] |
| 200 | + (setv output (+ B.home (.join "" output))) |
| 201 | + (with [(.synchronized-output B :timeout .05)] |
| 202 | + ; .05 s may well be too little time for SSH, but making the user |
| 203 | + ; not wait too long for a local terminal that just isn't |
| 204 | + ; responding, as is the more common case, is more important. |
| 205 | + (print output :flush T :end ""))) |
| 206 | + |
199 | 207 | ;; -------------------------------------------------------------- |
200 | 208 | ;; ** The main loop for IO |
201 | 209 | ;; -------------------------------------------------------------- |
|
220 | 228 | (msg (get e.args 0))))))) |
221 | 229 |
|
222 | 230 | (defn print-main-screen [#** kwargs] |
223 | | - (print |
224 | | - :flush T :sep "" :end "" |
225 | | - B.home |
226 | | - (.join "\n" (map (fn [x] (bless-colorstr B x)) (draw-screen |
227 | | - B.width B.height #** kwargs))))) |
| 231 | + (print-full-screen (.join "\n" (gfor |
| 232 | + line (draw-screen B.width B.height #** kwargs) |
| 233 | + (bless-colorstr B line))))) |
228 | 234 |
|
229 | 235 | ;; -------------------------------------------------------------- |
230 | 236 | ;; ** Text screens |
|
305 | 311 | (io-mode |
306 | 312 |
|
307 | 313 | :draw (fn [] |
308 | | - (print |
309 | | - :flush T :sep "" :end "" |
310 | | - B.home B.clear |
| 314 | + (print-full-screen |
| 315 | + B.clear |
311 | 316 | (.join "\n" (cut lines |
312 | 317 | top-line-ix |
313 | 318 | (+ top-line-ix B.height)))) |
|
346 | 351 | (io-mode |
347 | 352 |
|
348 | 353 | :draw (fn [] |
349 | | - (print |
350 | | - :flush T :sep "" :end "" |
351 | | - B.home B.clear |
| 354 | + (print-full-screen |
| 355 | + B.clear |
352 | 356 | (.join "\n" (gfor |
353 | 357 | line (cut display-lines B.height) |
354 | 358 | (cut line B.width))))) |
|
0 commit comments