Update terminal drawing operation costs on resize.
authorTaylor R Campbell <campbell@mumble.net>
Thu, 28 Apr 2011 22:11:02 +0000 (22:11 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Thu, 28 Apr 2011 22:25:41 +0000 (22:25 +0000)
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

index 63d7b71a7e3e02104027910e53b591d69ffd5d1e..952a82be1f0bf9110c0f657f5294127f5c8444c9 100644 (file)
@@ -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