Commit 4a240b94 authored by Chong Yidong's avatar Chong Yidong

(try_window_reusing_current_matrix): Ensure that window cursor

position is valid after scrolling.
parent 5fd15622
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment