7592 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
7593 |
XSETWINDOW (window, w); |
XSETWINDOW (window, w); |
7594 |
SET_TEXT_POS (start, BEG, BEG_BYTE); |
SET_TEXT_POS (start, BEG, BEG_BYTE); |
7595 |
try_window (window, start); |
try_window (window, start, 0); |
7596 |
|
|
7597 |
return window_height_changed_p; |
return window_height_changed_p; |
7598 |
} |
} |
11570 |
|
|
11571 |
/* Display the window. Give up if new fonts are loaded, or if point |
/* Display the window. Give up if new fonts are loaded, or if point |
11572 |
doesn't appear. */ |
doesn't appear. */ |
11573 |
if (!try_window (window, startp)) |
if (!try_window (window, startp, 0)) |
11574 |
rc = SCROLLING_NEED_LARGER_MATRICES; |
rc = SCROLLING_NEED_LARGER_MATRICES; |
11575 |
else if (w->cursor.vpos < 0) |
else if (w->cursor.vpos < 0) |
11576 |
{ |
{ |
12173 |
{ |
{ |
12174 |
/* We set this later on if we have to adjust point. */ |
/* We set this later on if we have to adjust point. */ |
12175 |
int new_vpos = -1; |
int new_vpos = -1; |
12176 |
|
int val; |
12177 |
|
|
12178 |
w->force_start = Qnil; |
w->force_start = Qnil; |
12179 |
w->vscroll = 0; |
w->vscroll = 0; |
12207 |
|
|
12208 |
/* Redisplay, then check if cursor has been set during the |
/* Redisplay, then check if cursor has been set during the |
12209 |
redisplay. Give up if new fonts were loaded. */ |
redisplay. Give up if new fonts were loaded. */ |
12210 |
if (!try_window (window, startp)) |
val = try_window (window, startp, 1); |
12211 |
|
if (!val) |
12212 |
{ |
{ |
12213 |
w->force_start = Qt; |
w->force_start = Qt; |
12214 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
12215 |
goto need_larger_matrices; |
goto need_larger_matrices; |
12216 |
} |
} |
12217 |
|
/* Point was outside the scroll margins. */ |
12218 |
|
if (val < 0) |
12219 |
|
new_vpos = window_box_height (w) / 2; |
12220 |
|
|
12221 |
if (w->cursor.vpos < 0 && !w->frozen_window_start_p) |
if (w->cursor.vpos < 0 && !w->frozen_window_start_p) |
12222 |
{ |
{ |
12259 |
&& !NILP (current_buffer->mark_active)) |
&& !NILP (current_buffer->mark_active)) |
12260 |
{ |
{ |
12261 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
12262 |
if (!try_window (window, startp)) |
if (!try_window (window, startp, 0)) |
12263 |
goto need_larger_matrices; |
goto need_larger_matrices; |
12264 |
} |
} |
12265 |
} |
} |
12349 |
= try_window_reusing_current_matrix (w))) |
= try_window_reusing_current_matrix (w))) |
12350 |
{ |
{ |
12351 |
IF_DEBUG (debug_method_add (w, "1")); |
IF_DEBUG (debug_method_add (w, "1")); |
12352 |
try_window (window, startp); |
if (try_window (window, startp, 1) < 0) |
12353 |
|
/* -1 means we need to scroll. |
12354 |
|
0 means we need new matrices, but fonts_changed_p |
12355 |
|
is set in that case, so we will detect it below. */ |
12356 |
|
goto try_to_scroll; |
12357 |
} |
} |
12358 |
|
|
12359 |
if (fonts_changed_p) |
if (fonts_changed_p) |
12483 |
|| MINI_WINDOW_P (w) |
|| MINI_WINDOW_P (w) |
12484 |
|| !(used_current_matrix_p |
|| !(used_current_matrix_p |
12485 |
= try_window_reusing_current_matrix (w))) |
= try_window_reusing_current_matrix (w))) |
12486 |
try_window (window, startp); |
try_window (window, startp, 0); |
12487 |
|
|
12488 |
/* If new fonts have been loaded (due to fontsets), give up. We |
/* If new fonts have been loaded (due to fontsets), give up. We |
12489 |
have to start a new redisplay since we need to re-adjust glyph |
have to start a new redisplay since we need to re-adjust glyph |
12503 |
{ |
{ |
12504 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
12505 |
move_it_by_lines (&it, 1, 0); |
move_it_by_lines (&it, 1, 0); |
12506 |
try_window (window, it.current.pos); |
try_window (window, it.current.pos, 0); |
12507 |
} |
} |
12508 |
else if (PT < IT_CHARPOS (it)) |
else if (PT < IT_CHARPOS (it)) |
12509 |
{ |
{ |
12510 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
12511 |
move_it_by_lines (&it, -1, 0); |
move_it_by_lines (&it, -1, 0); |
12512 |
try_window (window, it.current.pos); |
try_window (window, it.current.pos, 0); |
12513 |
} |
} |
12514 |
else |
else |
12515 |
{ |
{ |
12692 |
|
|
12693 |
|
|
12694 |
/* Build the complete desired matrix of WINDOW with a window start |
/* Build the complete desired matrix of WINDOW with a window start |
12695 |
buffer position POS. Value is non-zero if successful. It is zero |
buffer position POS. |
12696 |
if fonts were loaded during redisplay which makes re-adjusting |
|
12697 |
glyph matrices necessary. */ |
Value is 1 if successful. It is zero if fonts were loaded during |
12698 |
|
redisplay which makes re-adjusting glyph matrices necessary, and -1 |
12699 |
|
if point would appear in the scroll margins. |
12700 |
|
(We check that only if CHECK_MARGINS is nonzero. */ |
12701 |
|
|
12702 |
int |
int |
12703 |
try_window (window, pos) |
try_window (window, pos, check_margins) |
12704 |
Lisp_Object window; |
Lisp_Object window; |
12705 |
struct text_pos pos; |
struct text_pos pos; |
12706 |
|
int check_margins; |
12707 |
{ |
{ |
12708 |
struct window *w = XWINDOW (window); |
struct window *w = XWINDOW (window); |
12709 |
struct it it; |
struct it it; |
12728 |
return 0; |
return 0; |
12729 |
} |
} |
12730 |
|
|
12731 |
|
/* Don't let the cursor end in the scroll margins. */ |
12732 |
|
if (check_margins) |
12733 |
|
{ |
12734 |
|
int this_scroll_margin, cursor_height; |
12735 |
|
|
12736 |
|
this_scroll_margin = max (0, scroll_margin); |
12737 |
|
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
12738 |
|
this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
12739 |
|
cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; |
12740 |
|
|
12741 |
|
if ((w->cursor.y < this_scroll_margin |
12742 |
|
&& CHARPOS (pos) > BEGV) |
12743 |
|
/* Old redisplay didn't take scroll margin into account at the bottom, |
12744 |
|
but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */ |
12745 |
|
|| (w->cursor.y + (make_cursor_line_fully_visible_p |
12746 |
|
? cursor_height + this_scroll_margin |
12747 |
|
: 1)) > it.last_visible_y) |
12748 |
|
{ |
12749 |
|
w->cursor.vpos = -1; |
12750 |
|
clear_glyph_matrix (w->desired_matrix); |
12751 |
|
return -1; |
12752 |
|
} |
12753 |
|
} |
12754 |
|
|
12755 |
/* If bottom moved off end of frame, change mode line percentage. */ |
/* If bottom moved off end of frame, change mode line percentage. */ |
12756 |
if (XFASTINT (w->window_end_pos) <= 0 |
if (XFASTINT (w->window_end_pos) <= 0 |
12757 |
&& Z != IT_CHARPOS (it)) |
&& Z != IT_CHARPOS (it)) |