Mercurial > emacs
changeset 72664:17130b0d4269
(pos_visible_p): Remove exact_mode_line_heights_p arg;
so always calculate heights even when pos-visible-in-window-p is
called with partially = t. Don't overshoot last_visible_y in move_it_to.
Return row height and row number in new rowh and vpos args.
(cursor_row_fully_visible_p): First line is always "fully visible".
(try_window): Don't clear matrix if vscrolled.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 05 Sep 2006 22:49:51 +0000 |
parents | 6e654c485c0a |
children | 93d475a647a1 |
files | src/xdisp.c |
diffstat | 1 files changed, 35 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Tue Sep 05 22:49:43 2006 +0000 +++ b/src/xdisp.c Tue Sep 05 22:49:51 2006 +0000 @@ -1272,13 +1272,12 @@ /* Return 1 if position CHARPOS is visible in window W. If visible, set *X and *Y to pixel coordinates of top left corner. Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. - EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line - and header-lines heights. */ + Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ int -pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) - struct window *w; - int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; +pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) + struct window *w; + int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos; { struct it it; struct text_pos top; @@ -1296,22 +1295,19 @@ SET_TEXT_POS_FROM_MARKER (top, w->start); - /* Compute exact mode line heights, if requested. */ - if (exact_mode_line_heights_p) - { - if (WINDOW_WANTS_MODELINE_P (w)) - current_mode_line_height - = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), - current_buffer->mode_line_format); - - if (WINDOW_WANTS_HEADER_LINE_P (w)) - current_header_line_height - = display_mode_line (w, HEADER_LINE_FACE_ID, + /* Compute exact mode line heights. */ + if (WINDOW_WANTS_MODELINE_P (w)) + current_mode_line_height + = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), + current_buffer->mode_line_format); + + if (WINDOW_WANTS_HEADER_LINE_P (w)) + current_header_line_height + = display_mode_line (w, HEADER_LINE_FACE_ID, current_buffer->header_line_format); - } start_display (&it, w, top); - move_it_to (&it, charpos, -1, it.last_visible_y, -1, + move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, MOVE_TO_POS | MOVE_TO_Y); /* Note that we may overshoot because of invisible text. */ @@ -1332,6 +1328,9 @@ *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); *rtop = max (0, window_top_y - top_y); *rbot = max (0, bottom_y - it.last_visible_y); + *rowh = max (0, (min (bottom_y, it.last_visible_y) + - max (top_y, window_top_y))); + *vpos = it.vpos; } } else @@ -1350,6 +1349,11 @@ *rtop = max (0, -it2.current_y); *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y)); + *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent, + it.last_visible_y) + - max (it2.current_y, + WINDOW_HEADER_LINE_HEIGHT (w)))); + *vpos = it2.vpos; } } @@ -1361,6 +1365,15 @@ if (visible_p && XFASTINT (w->hscroll) > 0) *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); +#if 0 + /* Debugging code. */ + if (visible_p) + fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n", + charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos); + else + fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll); +#endif + return visible_p; } @@ -12023,7 +12036,8 @@ window_height = window_box_height (w); if (row->height >= window_height) { - if (!force_p || MINI_WINDOW_P (w) || w->vscroll) + if (!force_p || MINI_WINDOW_P (w) + || w->vscroll || w->cursor.vpos == 0) return 1; } return 0; @@ -13507,7 +13521,8 @@ this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); - if ((w->cursor.y < this_scroll_margin + if ((w->cursor.y >= 0 /* not vscrolled */ + && w->cursor.y < this_scroll_margin && CHARPOS (pos) > BEGV && IT_CHARPOS (it) < ZV) /* rms: considering make_cursor_line_fully_visible_p here