Fix bug: modeline "modified" indicator not properly updated when
authorChris Hanson <org/chris-hanson/cph>
Thu, 18 Mar 1999 02:29:30 +0000 (02:29 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 18 Mar 1999 02:29:30 +0000 (02:29 +0000)
buffer unmodified and initial changes are outside the visible portion
of the buffer.

v7/src/edwin/buffrm.scm
v7/src/edwin/modwin.scm

index d96fb77fa7f7b42c37c10cb85bdd098bbc6e51dd..415a1162360eb96a03886d17e5f4922826cb2fdc 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: buffrm.scm,v 1.53 1999/01/02 06:11:34 cph Exp $
+;;; $Id: buffrm.scm,v 1.54 1999/03/18 02:27:56 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology
 ;;;
   (with-instance-variables buffer-frame frame ()
     (inferior-window text-inferior)))
 
+(define-integrable (frame-modeline-inferior frame)
+  (with-instance-variables buffer-frame frame ()
+    (and modeline-inferior
+        (inferior-window modeline-inferior))))
+
 (define-method buffer-frame (:set-size! window x y)
   (set-buffer-frame-size! window x y))
 
   (buffer-window/redraw! (frame-text-inferior frame)))
 
 (define (window-modeline-event! frame type)
-  (with-instance-variables buffer-frame frame (type)
-    (if modeline-inferior
-       (modeline-window:event! (inferior-window modeline-inferior) type)))
+  (let ((window (frame-modeline-inferior frame)))
+    (if window
+       (modeline-window:event! window type)))
   (screen-modeline-event! (window-screen frame) frame type))
 
 (define (notice-window-changes! frame)
+  (let ((window (frame-modeline-inferior frame)))
+    (if window
+       (modeline-window:notice-changes! window)))
   (%notice-window-changes! (frame-text-inferior frame)))
 \f
 (define-integrable (window-override-message window)
index 547f4f362e444bea88ee8e68f063747cfe7d3c08..a2d66240df788f35d06e5e4752915555db246309 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;$Id: modwin.scm,v 1.40 1999/01/02 06:11:34 cph Exp $
+;;;$Id: modwin.scm,v 1.41 1999/03/18 02:29:30 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology
 ;;;
 
 (declare (usual-integrations))
 \f
-(define-class modeline-window vanilla-window ())
+(define-class modeline-window vanilla-window
+  (shows-buffer-modified?))
+
+(define (modeline-window/shows-buffer-modified? window)
+  (with-instance-variables modeline-window window ()
+    shows-buffer-modified?))
+
+(define (set-modeline-window/shows-buffer-modified?! window value)
+  (with-instance-variables modeline-window window (value)
+    (set! shows-buffer-modified? value)))
 
 (define-method modeline-window (:initialize! window window*)
   (usual=> window :initialize! window*)
-  (set! y-size 1))
+  (set! y-size 1)
+  (set! shows-buffer-modified? #f))
 
 (define (modeline-window:update-display! window screen x-start y-start
                                         xl xu yl yu display-style)
       (let ((superior (window-superior window))
            (xl (fix:+ x-start xl))
            (xu (fix:+ x-start xu)))
-       (modeline-string!
-        superior
-        (screen-get-output-line
-         screen y-start xl xu
-         (variable-local-value (window-buffer superior)
-                               (ref-variable-object mode-line-inverse-video)))
-        xl xu)))
-  true)
+       (let ((buffer (window-buffer superior)))
+         (modeline-string!
+          superior
+          (screen-get-output-line
+           screen y-start xl xu
+           (ref-variable mode-line-inverse-video buffer))
+          xl xu)
+         (set-modeline-window/shows-buffer-modified?!
+          window
+          (buffer-modified? buffer)))))
+  #t)
 
 (define-method modeline-window :update-display!
   modeline-window:update-display!)
 
 (define-variable mode-line-inverse-video
   "True means use inverse video, or other suitable display mode, for the mode line."
-  true
+  #t
   boolean?)
 
 (define (modeline-window:event! window type)
   type                                 ;ignored
-  (with-instance-variables modeline-window window ()
-    (setup-redisplay-flags! redisplay-flags)))
\ No newline at end of file
+  (window-needs-redisplay! window))
+
+(define (modeline-window:notice-changes! window)
+  (if (not (boolean=? (buffer-modified?
+                      (window-buffer (window-superior window)))
+                     (modeline-window/shows-buffer-modified? window)))
+      (window-needs-redisplay! window)))
\ No newline at end of file