aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-10-25 11:55:10 +0000
committerGerd Moellmann2000-10-25 11:55:10 +0000
commit3a641a69d3f069de8814550233e44e39df505894 (patch)
tree22927d21b05995e7527a07dda9885d0c6ff53c19 /src
parentc4586ad1d87ea75fd9e0b6967a74dacf5df6a02c (diff)
downloademacs-3a641a69d3f069de8814550233e44e39df505894.tar.gz
emacs-3a641a69d3f069de8814550233e44e39df505894.zip
(pos_visible_p): New function.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 97791fb5e21..9bf8aa9ef6d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -929,6 +929,52 @@ window_box_edges (w, area, top_left_x, top_left_y,
929 Utilities 929 Utilities
930 ***********************************************************************/ 930 ***********************************************************************/
931 931
932/* Return 1 if position CHARPOS is visible in window W.
933 Set *FULLY to 1 if POS is visible and the line containing
934 POS is fully visible. */
935
936int
937pos_visible_p (w, charpos, fully)
938 struct window *w;
939 int charpos, *fully;
940{
941 struct it it;
942 struct text_pos top;
943 int visible_p, bottom_y;
944
945 *fully = visible_p = 0;
946 SET_TEXT_POS_FROM_MARKER (top, w->start);
947 start_display (&it, w, top);
948
949 move_it_to (&it, charpos, 0, it.last_visible_y, -1,
950 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
951
952 if (IT_CHARPOS (it) == charpos)
953 {
954 int line_height;
955
956 if (it.max_ascent == 0 && it.max_descent == 0)
957 line_height = it.current_y + last_height;
958 else
959 line_height = it.current_y + it.max_ascent + it.max_descent;
960
961 *fully = it.current_y + line_height <= it.last_visible_y;
962 visible_p = 1;
963 }
964 else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y)
965 {
966 move_it_by_lines (&it, 1, 0);
967 if (charpos < IT_CHARPOS (it))
968 {
969 visible_p = 1;
970 *fully = 0;
971 }
972 }
973
974 return visible_p;
975}
976
977
932/* Return the next character from STR which is MAXLEN bytes long. 978/* Return the next character from STR which is MAXLEN bytes long.
933 Return in *LEN the length of the character. This is like 979 Return in *LEN the length of the character. This is like
934 STRING_CHAR_AND_LENGTH but never returns an invalid character. If 980 STRING_CHAR_AND_LENGTH but never returns an invalid character. If