Fix bug: redisplay was needlessly recentering point whenever a change
authorChris Hanson <org/chris-hanson/cph>
Tue, 13 Feb 1996 00:03:32 +0000 (00:03 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 13 Feb 1996 00:03:32 +0000 (00:03 +0000)
started at the first visible position of the buffer.  This is rarely
necessary.  This bug was deliberately introduced in revision 1.25 to
fix a more serious bug, in which the point could be left off-screen at
the end of redisplay.  This change fixes both bugs, by requesting
redisplay whenever a change might affect point's position; previously
it was incorrectly assumed that this request was unnecessary.

v7/src/edwin/bufwiu.scm

index 14c718d44b67dc6a23d89b3a9288bb46f02e7a56..932823c364a2c1077cbacf272c66479857bcd5e1 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: bufwiu.scm,v 1.29 1994/09/08 20:34:04 adams Exp $
+;;;    $Id: bufwiu.scm,v 1.30 1996/02/13 00:03:32 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-94 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-96 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
                  ;; been updated to reflect these changes.
                  (%set-window-modified-tick! window
                                              (group-modified-tick group))))
-         (if (and start (%window-start-line-mark window))
+         (if start
              (begin
                ;; If this change affects START-MARK, invalidate it
-               ;; and request a display update.
-               (if (and (fix:<= start (%window-start-index window))
-                        (fix:<= (%window-start-line-index window) end))
+               ;; and request a display update.  Don't invalidate
+               ;; START-MARK unless the changes require it.
+               (if (and (%window-start-line-mark window)
+                        (let ((wlstart (%window-start-line-index window))
+                              (wstart (%window-start-index window)))
+                          (and (if (and (fix:= wlstart wstart)
+                                        (fix:= (%window-start-partial window)
+                                               0))
+                                   (fix:< start wstart)
+                                   (fix:<= start wstart))
+                               (fix:<= wlstart end))))
                    (begin
                      (clear-window-start! window)
                      (window-needs-redisplay! window)))
-               ;; If this change affects POINT, invalidate it.  It's
-               ;; not necessary to request a display update here
-               ;; because POINT is always in the visible region of
-               ;; the buffer.
-               (if (and (not (eq? (%window-point-moved? window)
-                                  'SINCE-START-SET))
-                        (fix:<= start (%window-point-index window))
+               ;; If this change affects POINT, invalidate it and
+               ;; request a display update.
+               (if (and (fix:<= start (%window-point-index window))
                         (fix:<= (%window-point-index window) end))
-                   (%set-window-point-moved?! window
-                                              'SINCE-START-SET))))))))
+                   (begin
+                     (%set-window-point-moved?! window 'SINCE-START-SET)
+                     (window-needs-redisplay! window)))))))))
 \f
 ;;;; Clip