diff options
| author | Stefan Monnier | 2008-01-19 05:11:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-01-19 05:11:02 +0000 |
| commit | c3b232e48e3200d4a3350f73213709e1bf12145c (patch) | |
| tree | e379cc97f9bf7376fe0074d02c930934fade7f8d /src | |
| parent | fcd094c7fc8ee6bcfdda6617d4989cb0f0798b01 (diff) | |
| download | emacs-c3b232e48e3200d4a3350f73213709e1bf12145c.tar.gz emacs-c3b232e48e3200d4a3350f73213709e1bf12145c.zip | |
(set_window_buffer): Don't unnecessarily reset hscroll and
vscroll if we're setting window-buffer to the value it already has.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/window.c | 33 |
2 files changed, 28 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d63c039592a..2f30dfcf807 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-01-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * window.c (set_window_buffer): Don't unnecessarily reset hscroll and | ||
| 4 | vscroll if we're setting window-buffer to the value it already has. | ||
| 5 | |||
| 1 | 2008-01-18 Dan Nicolaescu <dann@ics.uci.edu> | 6 | 2008-01-18 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 7 | ||
| 3 | * m/intel386.h: Remove references to XENIX. | 8 | * m/intel386.h: Remove references to XENIX. |
diff --git a/src/window.c b/src/window.c index f1e37b756ab..bf36cbc032f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3321,6 +3321,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 3321 | struct window *w = XWINDOW (window); | 3321 | struct window *w = XWINDOW (window); |
| 3322 | struct buffer *b = XBUFFER (buffer); | 3322 | struct buffer *b = XBUFFER (buffer); |
| 3323 | int count = SPECPDL_INDEX (); | 3323 | int count = SPECPDL_INDEX (); |
| 3324 | int samebuf = EQ (buffer, w->buffer); | ||
| 3324 | 3325 | ||
| 3325 | w->buffer = buffer; | 3326 | w->buffer = buffer; |
| 3326 | 3327 | ||
| @@ -3339,16 +3340,28 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 3339 | XSETFASTINT (w->window_end_vpos, 0); | 3340 | XSETFASTINT (w->window_end_vpos, 0); |
| 3340 | bzero (&w->last_cursor, sizeof w->last_cursor); | 3341 | bzero (&w->last_cursor, sizeof w->last_cursor); |
| 3341 | w->window_end_valid = Qnil; | 3342 | w->window_end_valid = Qnil; |
| 3342 | w->hscroll = w->min_hscroll = make_number (0); | 3343 | if (!(keep_margins_p && samebuf)) |
| 3343 | w->vscroll = 0; | 3344 | { /* If we're not actually changing the buffer, Don't reset hscroll and |
| 3344 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3345 | vscroll. This case happens for example when called from |
| 3345 | set_marker_restricted (w->start, | 3346 | change_frame_size_1, where we use a dummy call to |
| 3346 | make_number (b->last_window_start), | 3347 | Fset_window_buffer on the frame's selected window (and no other) |
| 3347 | buffer); | 3348 | just in order to run window-configuration-change-hook. |
| 3348 | w->start_at_line_beg = Qnil; | 3349 | Resetting hscroll and vscroll here is problematic for things like |
| 3349 | w->force_start = Qnil; | 3350 | image-mode and doc-view-mode since it resets the image's position |
| 3350 | XSETFASTINT (w->last_modified, 0); | 3351 | whenever we resize the frame. */ |
| 3351 | XSETFASTINT (w->last_overlay_modified, 0); | 3352 | w->hscroll = w->min_hscroll = make_number (0); |
| 3353 | w->vscroll = 0; | ||
| 3354 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | ||
| 3355 | set_marker_restricted (w->start, | ||
| 3356 | make_number (b->last_window_start), | ||
| 3357 | buffer); | ||
| 3358 | w->start_at_line_beg = Qnil; | ||
| 3359 | w->force_start = Qnil; | ||
| 3360 | XSETFASTINT (w->last_modified, 0); | ||
| 3361 | XSETFASTINT (w->last_overlay_modified, 0); | ||
| 3362 | } | ||
| 3363 | /* Maybe we could move this into the `if' but it's not obviously safe and | ||
| 3364 | I doubt it's worth the trouble. */ | ||
| 3352 | windows_or_buffers_changed++; | 3365 | windows_or_buffers_changed++; |
| 3353 | 3366 | ||
| 3354 | /* We must select BUFFER for running the window-scroll-functions. | 3367 | /* We must select BUFFER for running the window-scroll-functions. |