From bf7152ab211e035c980f45cc782fcd36608d2ec2 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 28 Apr 2011 22:11:02 +0000 Subject: [PATCH] Update terminal drawing operation costs on resize. Fixes random errors during redraw after expanding your terminal. Evidently nobody uses Edwin in a terminal, at least since I broke this five years ago... --- src/edwin/tterm.scm | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/edwin/tterm.scm b/src/edwin/tterm.scm index 63d7b71a7..952a82be1 100644 --- a/src/edwin/tterm.scm +++ b/src/edwin/tterm.scm @@ -427,11 +427,11 @@ USA. (description false read-only true) (baud-rate-index false read-only true) (baud-rate false read-only true) - (insert-line-cost false read-only true) - (insert-line-next-cost false read-only true) - (delete-line-cost false read-only true) - (delete-line-next-cost false read-only true) - (scroll-region-cost false read-only true) + (insert-line-cost false) + (insert-line-next-cost false) + (delete-line-cost false) + (delete-line-next-cost false) + (scroll-region-cost false) (cursor-x false) (cursor-y false) (standout-mode? false) @@ -1182,9 +1182,24 @@ Note that the multiply factors are in tenths of characters. |# (if (or (not (= x-size (screen-x-size screen))) (not (= y-size (screen-y-size screen)))) (begin - (without-interrupts - (lambda () - (set-tn-x-size! desc x-size) - (set-tn-y-size! desc y-size) - (set-screen-size! screen x-size y-size))) - (update-screen! screen #t)))))))) \ No newline at end of file + (update-terminal-size! screen state desc x-size y-size) + (update-screen! screen #t)))))))) + +(define (update-terminal-size! screen state desc x-size y-size) + (receive (insert-line-cost + insert-line-next-cost + delete-line-cost + delete-line-next-cost + scroll-region-cost) + (let ((baud-rate (terminal-state/baud-rate state))) + (compute-scrolling-costs desc baud-rate x-size y-size)) + (without-interrupts + (lambda () + (set-tn-x-size! desc x-size) + (set-tn-y-size! desc y-size) + (set-terminal-state/insert-line-cost! state insert-line-cost) + (set-terminal-state/insert-line-next-cost! state insert-line-next-cost) + (set-terminal-state/delete-line-cost! state delete-line-cost) + (set-terminal-state/delete-line-next-cost! state delete-line-next-cost) + (set-terminal-state/scroll-region-cost! state scroll-region-cost) + (set-screen-size! screen x-size y-size))))) \ No newline at end of file -- 2.25.1