11267 |
&& (FRAME_WINDOW_P (f) |
&& (FRAME_WINDOW_P (f) |
11268 |
|| !overlay_arrow_in_current_buffer_p ())) |
|| !overlay_arrow_in_current_buffer_p ())) |
11269 |
{ |
{ |
11270 |
int this_scroll_margin; |
int this_scroll_margin, top_scroll_margin; |
11271 |
struct glyph_row *row = NULL; |
struct glyph_row *row = NULL; |
11272 |
|
|
11273 |
#if GLYPH_DEBUG |
#if GLYPH_DEBUG |
11280 |
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
11281 |
this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
11282 |
|
|
11283 |
|
top_scroll_margin = this_scroll_margin; |
11284 |
|
if (WINDOW_WANTS_HEADER_LINE_P (w)) |
11285 |
|
top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w); |
11286 |
|
|
11287 |
/* Start with the row the cursor was displayed during the last |
/* Start with the row the cursor was displayed during the last |
11288 |
not paused redisplay. Give up if that row is not valid. */ |
not paused redisplay. Give up if that row is not valid. */ |
11289 |
if (w->last_cursor.vpos < 0 |
if (w->last_cursor.vpos < 0 |
11344 |
&& (MATRIX_ROW_START_CHARPOS (row) > PT |
&& (MATRIX_ROW_START_CHARPOS (row) > PT |
11345 |
|| (MATRIX_ROW_START_CHARPOS (row) == PT |
|| (MATRIX_ROW_START_CHARPOS (row) == PT |
11346 |
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row))) |
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row))) |
11347 |
&& (row->y > this_scroll_margin |
&& (row->y > top_scroll_margin |
11348 |
|| CHARPOS (startp) == BEGV)) |
|| CHARPOS (startp) == BEGV)) |
11349 |
{ |
{ |
11350 |
xassert (row->enabled_p); |
xassert (row->enabled_p); |
11372 |
++row; |
++row; |
11373 |
|
|
11374 |
/* If within the scroll margin, scroll. */ |
/* If within the scroll margin, scroll. */ |
11375 |
if (row->y < this_scroll_margin |
if (row->y < top_scroll_margin |
11376 |
&& CHARPOS (startp) != BEGV) |
&& CHARPOS (startp) != BEGV) |
11377 |
scroll_p = 1; |
scroll_p = 1; |
11378 |
} |
} |
12542 |
position. */ |
position. */ |
12543 |
if (pt_row) |
if (pt_row) |
12544 |
{ |
{ |
12545 |
w->cursor.vpos -= MATRIX_ROW_VPOS (first_reusable_row, |
w->cursor.vpos -= nrows_scrolled; |
12546 |
w->current_matrix); |
w->cursor.y -= first_reusable_row->y - start_row->y; |
|
w->cursor.y -= first_reusable_row->y; |
|
12547 |
} |
} |
12548 |
|
|
12549 |
/* Scroll the display. */ |
/* Scroll the display. */ |
12588 |
for (row -= nrows_scrolled; row < bottom_row; ++row) |
for (row -= nrows_scrolled; row < bottom_row; ++row) |
12589 |
row->enabled_p = 0; |
row->enabled_p = 0; |
12590 |
|
|
12591 |
|
/* Point may have moved to a different line, so we cannot assume that |
12592 |
|
the previous cursor position is valid; locate the correct row. */ |
12593 |
|
if (pt_row) |
12594 |
|
{ |
12595 |
|
for (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
12596 |
|
row < bottom_row && PT >= MATRIX_ROW_END_CHARPOS (row); |
12597 |
|
row++) |
12598 |
|
{ |
12599 |
|
w->cursor.vpos++; |
12600 |
|
w->cursor.y = row->y; |
12601 |
|
} |
12602 |
|
if (row < bottom_row) |
12603 |
|
{ |
12604 |
|
struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos; |
12605 |
|
while (glyph->charpos < PT) |
12606 |
|
{ |
12607 |
|
w->cursor.hpos++; |
12608 |
|
w->cursor.x += glyph->pixel_width; |
12609 |
|
glyph++; |
12610 |
|
} |
12611 |
|
} |
12612 |
|
} |
12613 |
|
|
12614 |
/* Adjust window end. A null value of last_text_row means that |
/* Adjust window end. A null value of last_text_row means that |
12615 |
the window end is in reused rows which in turn means that |
the window end is in reused rows which in turn means that |
12616 |
only its vpos can have changed. */ |
only its vpos can have changed. */ |
13394 |
|
|
13395 |
if ((w->cursor.y < this_scroll_margin |
if ((w->cursor.y < this_scroll_margin |
13396 |
&& CHARPOS (start) > BEGV) |
&& CHARPOS (start) > BEGV) |
13397 |
/* Don't take scroll margin into account at the bottom because |
/* Old redisplay didn't take scroll margin into account at the bottom, |
13398 |
old redisplay didn't do it either. */ |
but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ |
13399 |
|| w->cursor.y + cursor_height > it.last_visible_y) |
|| w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y) |
13400 |
{ |
{ |
13401 |
w->cursor.vpos = -1; |
w->cursor.vpos = -1; |
13402 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |