diff options
Diffstat (limited to 'src/xdisp.c')
-rw-r--r-- | src/xdisp.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 400cb1d1d7f..1fa19f7b7b7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1,6 +1,6 @@ /* Display generation from window structure and buffer text. -Copyright (C) 1985-1988, 1993-1995, 1997-2014 Free Software Foundation, +Copyright (C) 1985-1988, 1993-1995, 1997-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1413,6 +1413,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, struct text_pos top; int visible_p = 0; struct buffer *old_buffer = NULL; + bool r2l = false; if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) return visible_p; @@ -1698,6 +1699,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, *rowh = max (0, (min (bottom_y, it.last_visible_y) - max (top_y, window_top_y))); *vpos = it.vpos; + if (it.bidi_it.paragraph_dir == R2L) + r2l = true; } } else @@ -1727,6 +1730,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, - max (it2.current_y, WINDOW_HEADER_LINE_HEIGHT (w)))); *vpos = it2.vpos; + if (it2.bidi_it.paragraph_dir == R2L) + r2l = true; } else bidi_unshelve_cache (it2data, 1); @@ -1736,10 +1741,20 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, if (old_buffer) set_buffer_internal_1 (old_buffer); - if (visible_p && w->hscroll > 0) - *x -= - window_hscroll_limited (w, WINDOW_XFRAME (w)) - * WINDOW_FRAME_COLUMN_WIDTH (w); + if (visible_p) + { + if (w->hscroll > 0) + *x -= + window_hscroll_limited (w, WINDOW_XFRAME (w)) + * WINDOW_FRAME_COLUMN_WIDTH (w); + /* For lines in an R2L paragraph, we need to mirror the X pixel + coordinate wrt the text area. For the reasons, see the + commentary in buffer_posn_from_coords and the explanation of + the geometry used by the move_it_* functions at the end of + the large commentary near the beginning of this file. */ + if (r2l) + *x = window_box_width (w, TEXT_AREA) - *x - 1; + } #if 0 /* Debugging code. */ |