diff options
| author | Kim F. Storm | 2005-01-22 01:41:36 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-01-22 01:41:36 +0000 |
| commit | f15f5495d9403a19900402965ad3d34f78562ffa (patch) | |
| tree | a0d65e20bd8ce1ff1de5e8f7c6fcca97d5092121 /src | |
| parent | d0d0434fc31db95c42d02b2ce861b26652261129 (diff) | |
| download | emacs-f15f5495d9403a19900402965ad3d34f78562ffa.tar.gz emacs-f15f5495d9403a19900402965ad3d34f78562ffa.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 96313405860..a2f687cfb87 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1243,15 +1243,16 @@ line_bottom_y (it) | |||
| 1243 | } | 1243 | } |
| 1244 | 1244 | ||
| 1245 | 1245 | ||
| 1246 | /* Return 1 if position CHARPOS is visible in window W. Set *FULLY to | 1246 | /* Return 1 if position CHARPOS is visible in window W. |
| 1247 | 1 if POS is visible and the line containing POS is fully visible. | 1247 | If visible, set *X and *Y to pixel coordinates of top left corner. |
| 1248 | Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. | ||
| 1248 | EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line | 1249 | EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line |
| 1249 | and header-lines heights. */ | 1250 | and header-lines heights. */ |
| 1250 | 1251 | ||
| 1251 | int | 1252 | int |
| 1252 | pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) | 1253 | pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) |
| 1253 | struct window *w; | 1254 | struct window *w; |
| 1254 | int charpos, *fully, *x, *y, exact_mode_line_heights_p; | 1255 | int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; |
| 1255 | { | 1256 | { |
| 1256 | struct it it; | 1257 | struct it it; |
| 1257 | struct text_pos top; | 1258 | struct text_pos top; |
| @@ -1264,7 +1265,7 @@ pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) | |||
| 1264 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 1265 | set_buffer_internal_1 (XBUFFER (w->buffer)); |
| 1265 | } | 1266 | } |
| 1266 | 1267 | ||
| 1267 | *fully = visible_p = 0; | 1268 | visible_p = 0; |
| 1268 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1269 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1269 | 1270 | ||
| 1270 | /* Compute exact mode line heights, if requested. */ | 1271 | /* Compute exact mode line heights, if requested. */ |
| @@ -1295,14 +1296,16 @@ pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) | |||
| 1295 | if (top_y < window_top_y) | 1296 | if (top_y < window_top_y) |
| 1296 | visible_p = bottom_y > window_top_y; | 1297 | visible_p = bottom_y > window_top_y; |
| 1297 | else if (top_y < it.last_visible_y) | 1298 | else if (top_y < it.last_visible_y) |
| 1298 | { | ||
| 1299 | visible_p = 1; | 1299 | visible_p = 1; |
| 1300 | *fully = bottom_y <= it.last_visible_y; | ||
| 1301 | } | ||
| 1302 | if (visible_p && x) | 1300 | if (visible_p && x) |
| 1303 | { | 1301 | { |
| 1304 | *x = it.current_x; | 1302 | *x = it.current_x; |
| 1305 | *y = max (top_y + it.max_ascent - it.ascent, window_top_y); | 1303 | *y = max (top_y + it.max_ascent - it.ascent, window_top_y); |
| 1304 | if (rtop) | ||
| 1305 | { | ||
| 1306 | *rtop = max (0, window_top_y - top_y); | ||
| 1307 | *rbot = max (0, bottom_y - it.last_visible_y); | ||
| 1308 | } | ||
| 1306 | } | 1309 | } |
| 1307 | } | 1310 | } |
| 1308 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) | 1311 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) |
| @@ -1319,6 +1322,11 @@ pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) | |||
| 1319 | move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); | 1322 | move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); |
| 1320 | *x = it2.current_x; | 1323 | *x = it2.current_x; |
| 1321 | *y = it2.current_y + it2.max_ascent - it2.ascent; | 1324 | *y = it2.current_y + it2.max_ascent - it2.ascent; |
| 1325 | if (rtop) | ||
| 1326 | { | ||
| 1327 | *rtop = 0; | ||
| 1328 | *rbot = max (0, (it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y); | ||
| 1329 | } | ||
| 1322 | } | 1330 | } |
| 1323 | } | 1331 | } |
| 1324 | } | 1332 | } |