From c7792b269d2b150ce93ab5407c9a1ed6d278872c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 18 Mar 1999 02:29:30 +0000 Subject: [PATCH] Fix bug: modeline "modified" indicator not properly updated when buffer unmodified and initial changes are outside the visible portion of the buffer. --- v7/src/edwin/buffrm.scm | 16 ++++++++++---- v7/src/edwin/modwin.scm | 46 ++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/v7/src/edwin/buffrm.scm b/v7/src/edwin/buffrm.scm index d96fb77fa..415a11623 100644 --- a/v7/src/edwin/buffrm.scm +++ b/v7/src/edwin/buffrm.scm @@ -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 ;;; @@ -93,6 +93,11 @@ (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)) @@ -191,12 +196,15 @@ (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))) (define-integrable (window-override-message window) diff --git a/v7/src/edwin/modwin.scm b/v7/src/edwin/modwin.scm index 547f4f362..a2d66240d 100644 --- a/v7/src/edwin/modwin.scm +++ b/v7/src/edwin/modwin.scm @@ -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 ;;; @@ -22,11 +22,21 @@ (declare (usual-integrations)) -(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) @@ -35,24 +45,32 @@ (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 -- 2.25.1