From 8964fd83cd1a923a3c3890005d1c4def52d4730e Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Thu, 10 Mar 2005 14:55:22 +0000 Subject: [PATCH] (pos_visible_p): Fix X value in last line of buffer. --- src/xdisp.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 9c2d3c2554d..42f0097a7cb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1298,6 +1298,7 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) /* Note that we may overshoot because of invisible text. */ if (IT_CHARPOS (it) >= charpos) { + int top_x = it.current_x; int top_y = it.current_y; int bottom_y = (last_height = 0, line_bottom_y (&it)); int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); @@ -1306,15 +1307,12 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) visible_p = bottom_y > window_top_y; else if (top_y < it.last_visible_y) visible_p = 1; - if (visible_p && x) + if (visible_p) { - *x = it.current_x; + *x = top_x; *y = max (top_y + max (0, 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); - } + *rtop = max (0, window_top_y - top_y); + *rbot = max (0, bottom_y - it.last_visible_y); } } else @@ -1327,18 +1325,12 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) if (charpos < IT_CHARPOS (it)) { visible_p = 1; - if (x) - { - 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 = max (0, -it2.current_y); - *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) - - it.last_visible_y)); - } - } + move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); + *x = it2.current_x; + *y = it2.current_y + it2.max_ascent - it2.ascent; + *rtop = max (0, -it2.current_y); + *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) + - it.last_visible_y)); } } -- 2.39.2