From 4c66103fb3ee13c39ba53659f00b2c569307f3e8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 1 Jul 2015 19:27:13 +0300 Subject: [PATCH] Fix value of posn-at-pont in R2L lines * src/keyboard.c (Fposn_at_x_y, Fposn_at_point): Allow X pixel coordinate of -1, for a newline in a right-to-left line that overflowed into the left fringe. --- src/keyboard.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 8ea7b53a784..c5a392f862d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -10795,7 +10795,11 @@ The return value is similar to a mouse click position: The `posn-' functions access elements of such lists. */) (Lisp_Object x, Lisp_Object y, Lisp_Object frame_or_window, Lisp_Object whole) { - CHECK_NATNUM (x); + CHECK_NUMBER (x); + /* We allow X of -1, for the newline in a R2L line that overflowed + into the left fringe. */ + if (XINT (x) != -1) + CHECK_NATNUM (x); CHECK_NATNUM (y); if (NILP (frame_or_window)) @@ -10843,8 +10847,9 @@ The `posn-' functions access elements of such lists. */) Lisp_Object x = XCAR (tem); Lisp_Object y = XCAR (XCDR (tem)); - /* Point invisible due to hscrolling? */ - if (XINT (x) < 0) + /* Point invisible due to hscrolling? X can be -1 when a + newline in a R2L line overflows into the left fringe. */ + if (XINT (x) < -1) return Qnil; tem = Fposn_at_x_y (x, y, window, Qnil); } -- 2.39.5