Fix bug: UNDO-LEAVE-WINDOW! was being called on the wrong window from
authorChris Hanson <org/chris-hanson/cph>
Mon, 30 Oct 2000 15:41:04 +0000 (15:41 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 30 Oct 2000 15:41:04 +0000 (15:41 +0000)
SELECT-SCREEN and SELECT-WINDOW.  Also change order of arguments to
CHANGE-SELECTED-BUFFER to match order used most other places in this
file.

v7/src/edwin/curren.scm

index 0978214861092769dbdb55d9077a4a66102c13cb..f294114e99662da4f6c78898db28fa5603e40c95 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: curren.scm,v 1.139 2000/10/27 04:00:34 cph Exp $
+;;; $Id: curren.scm,v 1.140 2000/10/30 15:41:04 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -94,9 +94,9 @@ The frame is guaranteed to be deselected at that time."
               (let ((message (current-message)))
                 (clear-current-message!)
                 (screen-exit! screen*)
+                (undo-leave-window! (screen-selected-window screen*))
                 (let ((window (screen-selected-window screen)))
-                  (undo-leave-window! window)
-                  (change-selected-buffer window (window-buffer window) #t
+                  (change-selected-buffer (window-buffer window) window #t
                     (lambda ()
                       (set-editor-selected-screen! current-editor screen))))
                 (set-current-message! message)
@@ -191,12 +191,13 @@ The frame is guaranteed to be deselected at that time."
 (define (select-window window)
   (without-interrupts
    (lambda ()
-     (let ((screen (window-screen window)))
-       (if (not (eq? window (screen-selected-window screen)))
+     (let* ((screen (window-screen window))
+           (window* (screen-selected-window screen)))
+       (if (not (eq? window window*))
           (begin
-            (undo-leave-window! window)
+            (undo-leave-window! window*)
             (if (selected-screen? screen)
-                (change-selected-buffer window (window-buffer window) #t
+                (change-selected-buffer (window-buffer window) window #t
                   (lambda ()
                     (screen-select-window! screen window)))
                 (begin
@@ -471,14 +472,14 @@ The frame is guaranteed to be deselected at that time."
              (begin
                (undo-leave-window! window)
                (if (selected-window? window)
-                   (change-selected-buffer window buffer record?
+                   (change-selected-buffer buffer window record?
                      (lambda ()
                        (set-window-buffer! window buffer)))
                    (set-window-buffer! window buffer))
                #t))))
       (maybe-select-buffer-layout window buffer)))
 
-(define (change-selected-buffer window buffer record? selection-thunk)
+(define (change-selected-buffer buffer window record? selection-thunk)
   (change-local-bindings! (selected-buffer) buffer selection-thunk)
   (set-buffer-point! buffer (window-point window))
   (if record? (bufferset-select-buffer! (current-bufferset) buffer))