From c4280705666a91a0d0dc6cbca3e2e202657b6c86 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 7 Nov 2000 16:39:24 +0000 Subject: [PATCH] (Fset_window_configuration): Don't try to preserve point in the current buffer, if that buffer is displayed in more than one window. --- src/window.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/window.c b/src/window.c index 4a4fecae574..5257c1b0cdb 100644 --- a/src/window.c +++ b/src/window.c @@ -4501,7 +4501,6 @@ the return value is nil. Otherwise the value is t.") { if (XBUFFER (new_current_buffer) == current_buffer) old_point = PT; - } frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; @@ -4516,7 +4515,7 @@ the return value is nil. Otherwise the value is t.") struct window *root_window; struct window **leaf_windows; int n_leaf_windows; - int k, i; + int k, i, n; /* If the frame has been resized since this window configuration was made, we change the frame to the size specified in the @@ -4723,15 +4722,24 @@ the return value is nil. Otherwise the value is t.") #endif /* Now, free glyph matrices in windows that were not reused. */ - for (i = 0; i < n_leaf_windows; ++i) - if (NILP (leaf_windows[i]->buffer)) - { - /* Assert it's not reused as a combination. */ - xassert (NILP (leaf_windows[i]->hchild) - && NILP (leaf_windows[i]->vchild)); - free_window_matrices (leaf_windows[i]); - SET_FRAME_GARBAGED (f); - } + for (i = n = 0; i < n_leaf_windows; ++i) + { + if (NILP (leaf_windows[i]->buffer)) + { + /* Assert it's not reused as a combination. */ + xassert (NILP (leaf_windows[i]->hchild) + && NILP (leaf_windows[i]->vchild)); + free_window_matrices (leaf_windows[i]); + SET_FRAME_GARBAGED (f); + } + else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) + ++n; + } + + /* If more than one window shows the new and old current buffer, + don't try to preserve point in that buffer. */ + if (old_point > 0 && n > 1) + old_point = -1; adjust_glyphs (f); -- 2.39.5