changeset 66076:33c8db02dc18

(make_lispy_position): Adjust wx for left margin if ON_TEXT. (Fposn_at_x_y): Fix calculation of x coordinate. (Fposn_at_point): Return nil if point is hscrolled out of view.
author Kim F. Storm <storm@cua.dk>
date Thu, 13 Oct 2005 22:42:01 +0000
parents 1f435e64880f
children 68d711d80f2f 1cd4072747c6
files src/keyboard.c
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Thu Oct 13 22:41:40 2005 +0000
+++ b/src/keyboard.c	Thu Oct 13 22:42:01 2005 +0000
@@ -5054,7 +5054,11 @@
       XSETINT (*x, wx);
       XSETINT (*y, wy);
 
-      if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
+      if (part == ON_TEXT)
+	{
+	  wx += WINDOW_LEFT_MARGIN_WIDTH (w);
+	}
+      else if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
 	{
 	  /* Mode line or header line.  Look for a string under
 	     the mouse that may have a `local-map' property.  */
@@ -10592,11 +10596,11 @@
       CHECK_LIVE_WINDOW (frame_or_window);
 
       w = XWINDOW (frame_or_window);
-      XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x))
+      XSETINT (x, (XINT (x)
+		   + WINDOW_LEFT_EDGE_X (w)
 		   + (NILP (whole)
 		      ? window_box_left_offset (w, TEXT_AREA)
-		      : - (WINDOW_LEFT_SCROLL_BAR_COLS (w)
-			   * WINDOW_FRAME_COLUMN_WIDTH (w)))));
+		      : 0)));
       XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y)));
       frame_or_window = w->frame;
     }
@@ -10622,9 +10626,21 @@
 {
   Lisp_Object tem;
 
+  if (NILP (window))
+    window = selected_window;
+
   tem = Fpos_visible_in_window_p (pos, window, Qt);
   if (!NILP (tem))
-    tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil);
+    {
+      Lisp_Object x = XCAR (tem);
+      Lisp_Object y = XCAR (XCDR (tem));
+
+      /* Point invisible due to hscrolling?  */
+      if (XINT (x) < 0)
+	return Qnil;
+      tem = Fposn_at_x_y (x, y, window, Qnil);
+    }
+
   return tem;
 }