diff options
| author | Chong Yidong | 2008-11-07 00:29:07 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-11-07 00:29:07 +0000 |
| commit | 4a240b947eede312708308dd72c6f0e1c27d811b (patch) | |
| tree | 5564ad58af6aed168fac95211660046ea60b625b /src | |
| parent | 5fd1562210d8e387ab9416d4b29eeca19644198c (diff) | |
| download | emacs-4a240b947eede312708308dd72c6f0e1c27d811b.tar.gz emacs-4a240b947eede312708308dd72c6f0e1c27d811b.zip | |
(try_window_reusing_current_matrix): Ensure that window cursor
position is valid after scrolling.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7814bac5195..ee5ecbab447 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -14393,13 +14393,6 @@ try_window_reusing_current_matrix (w) | |||
| 14393 | if (display_line (&it)) | 14393 | if (display_line (&it)) |
| 14394 | last_text_row = it.glyph_row - 1; | 14394 | last_text_row = it.glyph_row - 1; |
| 14395 | 14395 | ||
| 14396 | /* Give up If point isn't in a row displayed or reused. */ | ||
| 14397 | if (w->cursor.vpos < 0) | ||
| 14398 | { | ||
| 14399 | clear_glyph_matrix (w->desired_matrix); | ||
| 14400 | return 0; | ||
| 14401 | } | ||
| 14402 | |||
| 14403 | /* If point is in a reused row, adjust y and vpos of the cursor | 14396 | /* If point is in a reused row, adjust y and vpos of the cursor |
| 14404 | position. */ | 14397 | position. */ |
| 14405 | if (pt_row) | 14398 | if (pt_row) |
| @@ -14408,6 +14401,16 @@ try_window_reusing_current_matrix (w) | |||
| 14408 | w->cursor.y -= first_reusable_row->y - start_row->y; | 14401 | w->cursor.y -= first_reusable_row->y - start_row->y; |
| 14409 | } | 14402 | } |
| 14410 | 14403 | ||
| 14404 | /* Give up if point isn't in a row displayed or reused. (This | ||
| 14405 | also handles the case where w->cursor.vpos < nrows_scrolled | ||
| 14406 | after the calls to display_line, which can happen with scroll | ||
| 14407 | margins. See bug#1295.) */ | ||
| 14408 | if (w->cursor.vpos < 0) | ||
| 14409 | { | ||
| 14410 | clear_glyph_matrix (w->desired_matrix); | ||
| 14411 | return 0; | ||
| 14412 | } | ||
| 14413 | |||
| 14411 | /* Scroll the display. */ | 14414 | /* Scroll the display. */ |
| 14412 | run.current_y = first_reusable_row->y; | 14415 | run.current_y = first_reusable_row->y; |
| 14413 | run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w); | 14416 | run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w); |