Mercurial > emacs
changeset 59676:7e0248c89780
(pos_visible_p): Replace FULLY arg by RTOP and RBOT args
to return number of partially invisible pixels at top and bottom
of the dislay row at POS.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 22 Jan 2005 01:41:36 +0000 |
parents | 5c0ac872ffdb |
children | d762442d2c8f |
files | src/xdisp.c |
diffstat | 1 files changed, 17 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Sat Jan 22 01:15:38 2005 +0000 +++ b/src/xdisp.c Sat Jan 22 01:41:36 2005 +0000 @@ -1243,15 +1243,16 @@ } -/* Return 1 if position CHARPOS is visible in window W. Set *FULLY to - 1 if POS is visible and the line containing POS is fully visible. +/* 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. */ int -pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) - struct window *w; - int charpos, *fully, *x, *y, exact_mode_line_heights_p; +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; { struct it it; struct text_pos top; @@ -1264,7 +1265,7 @@ set_buffer_internal_1 (XBUFFER (w->buffer)); } - *fully = visible_p = 0; + visible_p = 0; SET_TEXT_POS_FROM_MARKER (top, w->start); /* Compute exact mode line heights, if requested. */ @@ -1295,14 +1296,16 @@ if (top_y < window_top_y) visible_p = bottom_y > window_top_y; else if (top_y < it.last_visible_y) - { visible_p = 1; - *fully = bottom_y <= it.last_visible_y; - } if (visible_p && x) { *x = it.current_x; *y = max (top_y + it.max_ascent - it.ascent, window_top_y); + if (rtop) + { + *rtop = max (0, window_top_y - top_y); + *rbot = max (0, bottom_y - it.last_visible_y); + } } } else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) @@ -1319,6 +1322,11 @@ move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); *x = it2.current_x; *y = it2.current_y + it2.max_ascent - it2.ascent; + if (rtop) + { + *rtop = 0; + *rbot = max (0, (it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y); + } } } }