# HG changeset patch # User Kim F. Storm # Date 1129243321 0 # Node ID 33c8db02dc18f54d49173a193e3d4df4108adfeb # Parent 1f435e64880f31ee718d4fbd11f51050730f540d (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. diff -r 1f435e64880f -r 33c8db02dc18 src/keyboard.c --- 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; }