changeset 60549:8afba8c1216a

(pos_visible_p): Fix X value in last line of buffer.
author Kim F. Storm <storm@cua.dk>
date Thu, 10 Mar 2005 14:55:22 +0000
parents 0cb5cc0ad33c
children e7d6522f1b48
files src/xdisp.c
diffstat 1 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Thu Mar 10 14:54:37 2005 +0000
+++ b/src/xdisp.c	Thu Mar 10 14:55:22 2005 +0000
@@ -1298,6 +1298,7 @@
   /* 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 @@
 	visible_p = bottom_y > window_top_y;
       else if (top_y < it.last_visible_y)
 	  visible_p = 1;
-      if (visible_p && x)
-	{
-	  *x = it.current_x;
+      if (visible_p)
+	{
+	  *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 @@
       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));
 	}
     }