From f7abe0af306f08ab225815adf28fecf7856befe7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 17 Aug 2014 17:34:05 +0300 Subject: Fix bug #18277 with mouse clicks on R2L lines. src/dispnew.c (buffer_posn_from_coords): Fix mirroring of X coordinate for hscrolled R2L screen lines. --- src/dispnew.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/dispnew.c') diff --git a/src/dispnew.c b/src/dispnew.c index 7be4e0b4615..e6ab5bf1e9c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5129,9 +5129,8 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y); /* TO_X is the pixel position that the iterator will compute for the - glyph at *X. We add it.first_visible_x because iterator - positions include the hscroll. */ - to_x = x0 + it.first_visible_x; + glyph at *X. */ + to_x = x0; if (it.bidi_it.paragraph_dir == R2L) /* For lines in an R2L paragraph, we need to mirror TO_X wrt the text area. This is because the iterator, even in R2L @@ -5145,6 +5144,10 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p it should be mirrored into zero pixel position.) */ to_x = window_box_width (w, TEXT_AREA) - to_x - 1; + /* We need to add it.first_visible_x because iterator positions + include the hscroll. */ + to_x += it.first_visible_x; + /* Now move horizontally in the row to the glyph under *X. Second argument is ZV to prevent move_it_in_display_line from matching based on buffer positions. */ -- cgit v1.2.1