diff options
author | Chong Yidong <[email protected]> | 2008-11-07 00:29:07 +0000 |
---|---|---|
committer | Chong Yidong <[email protected]> | 2008-11-07 00:29:07 +0000 |
commit | 4a240b947eede312708308dd72c6f0e1c27d811b (patch) | |
tree | 5564ad58af6aed168fac95211660046ea60b625b /src | |
parent | 5fd1562210d8e387ab9416d4b29eeca19644198c (diff) |
(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 7814bac519..ee5ecbab44 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14393,13 +14393,6 @@ try_window_reusing_current_matrix (w) if (display_line (&it)) last_text_row = it.glyph_row - 1; - /* Give up If point isn't in a row displayed or reused. */ - if (w->cursor.vpos < 0) - { - clear_glyph_matrix (w->desired_matrix); - return 0; - } - /* If point is in a reused row, adjust y and vpos of the cursor position. */ if (pt_row) @@ -14408,6 +14401,16 @@ try_window_reusing_current_matrix (w) w->cursor.y -= first_reusable_row->y - start_row->y; } + /* Give up if point isn't in a row displayed or reused. (This + also handles the case where w->cursor.vpos < nrows_scrolled + after the calls to display_line, which can happen with scroll + margins. See bug#1295.) */ + if (w->cursor.vpos < 0) + { + clear_glyph_matrix (w->desired_matrix); + return 0; + } + /* Scroll the display. */ run.current_y = first_reusable_row->y; run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w); |