From 3222f469f340f8ae9f1c59243c0eb9a8dcbd30c9 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 26 Oct 2000 04:29:26 +0000 Subject: [PATCH] Don't reselect an already-selected window or buffer. --- v7/src/edwin/curren.scm | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/v7/src/edwin/curren.scm b/v7/src/edwin/curren.scm index a0d5d0872..fb05c383c 100644 --- a/v7/src/edwin/curren.scm +++ b/v7/src/edwin/curren.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: curren.scm,v 1.131 2000/10/26 04:21:26 cph Exp $ +;;; $Id: curren.scm,v 1.132 2000/10/26 04:29:26 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -186,15 +186,17 @@ The frame is guaranteed to be deselected at that time." (define (select-window window) (without-interrupts (lambda () - (undo-leave-window! window) (let ((screen (window-screen window))) - (if (selected-screen? screen) - (change-selected-buffer window (window-buffer window) #t - (lambda () - (screen-select-window! screen window))) + (if (not (eq? window (screen-selected-window screen))) (begin - (screen-select-window! screen window) - (select-screen screen))))))) + (undo-leave-window! window) + (if (selected-screen? screen) + (change-selected-buffer window (window-buffer window) #t + (lambda () + (screen-select-window! screen window))) + (begin + (screen-select-window! screen window) + (select-screen screen))))))))) (define (select-cursor window) (screen-select-cursor! (window-screen window) window)) @@ -460,13 +462,15 @@ The frame is guaranteed to be deselected at that time." (define (select-buffer-in-window buffer window record?) (without-interrupts (lambda () - (undo-leave-window! window) - (if (selected-window? window) - (change-selected-buffer window buffer record? - (lambda () - (set-window-buffer! window buffer))) - (set-window-buffer! window buffer)) - (maybe-select-buffer-layout window buffer)))) + (if (not (eq? buffer (window-buffer window))) + (begin + (undo-leave-window! window) + (if (selected-window? window) + (change-selected-buffer window buffer record? + (lambda () + (set-window-buffer! window buffer))) + (set-window-buffer! window buffer)) + (maybe-select-buffer-layout window buffer)))))) (define (change-selected-buffer window buffer record? selection-thunk) (change-local-bindings! (selected-buffer) buffer selection-thunk) -- 2.25.1