diff options
author | Karl Heuer <kwzh@gnu.org> | 1994-05-06 01:49:51 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1994-05-06 01:49:51 +0000 |
commit | 9ffa9640121b06da0f12ba9635f89adcbb65cb4e (patch) | |
tree | 97f19eddf6f977d96158fd7056f2fdf49356ef27 /src/window.c | |
parent | cff26f1a33791a8fab9f9601c5bf41e040034e32 (diff) | |
download | emacs-9ffa9640121b06da0f12ba9635f89adcbb65cb4e.tar.gz |
(Fdelete_other_windows): Do nothing if w->start is outside region.
Don't temporarily move point when recomputing window position.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/window.c b/src/window.c index c8e0988c387..ce0b05339ee 100644 --- a/src/window.c +++ b/src/window.c @@ -1346,8 +1346,7 @@ value is reasonable when this function is called.") Lisp_Object window; { struct window *w; - struct buffer *obuf = current_buffer; - int opoint; + int startpos; int top; if (NILP (window)) @@ -1356,21 +1355,34 @@ value is reasonable when this function is called.") CHECK_LIVE_WINDOW (window, 0); w = XWINDOW (window); - top = XFASTINT (w->top); + startpos = marker_position (w->start); + top = XFASTINT (w->top) - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w))); window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); - Fset_buffer (w->buffer); - opoint = PT; - SET_PT (marker_position (w->start)); - /* Like Frecenter but avoid setting w->force_start. */ - Fvertical_motion (make_number (- (top - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w))))), - window); - Fset_marker (w->start, make_number (PT), w->buffer); - w->start_at_line_beg = Fbolp (); - - SET_PT (opoint); - set_buffer_internal (obuf); + /* Try to minimize scrolling, by setting the window start to the point + will cause the text at the old window start to be at the same place + on the frame. But don't try to do this if the window start is + outside the visible portion (as might happen when the display is + not current, due to typeahead). */ + if (startpos >= BUF_BEGV (XBUFFER (w->buffer)) + && startpos <= BUF_ZV (XBUFFER (w->buffer))) + { + struct position pos; + struct buffer *obuf = current_buffer; + + Fset_buffer (w->buffer); + /* This computation used to temporarily move point, but that can + have unwanted side effects due to text properties. */ + pos = *vmotion (startpos, -top, window_internal_width (w) - 1, + XINT (w->hscroll), window); + Fset_marker (w->start, make_number (pos.bufpos), w->buffer); + w->start_at_line_beg = ((pos.bufpos == BEGV + || FETCH_CHAR (pos.bufpos - 1) == '\n') ? Qt + : Qnil); + + set_buffer_internal (obuf); + } return Qnil; } |