aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-12-30 19:29:24 +0200
committerEli Zaretskii2014-12-30 19:29:24 +0200
commitaa472a377134b7840fd7b9c97f948fb9440e6e9d (patch)
tree1b838e50144a51f21993097e4a4c6fef7337f86a /src
parentd2612290f973ed70d973292d728cbe12a7f722fb (diff)
downloademacs-aa472a377134b7840fd7b9c97f948fb9440e6e9d.tar.gz
emacs-aa472a377134b7840fd7b9c97f948fb9440e6e9d.zip
Fix the pixel coordinates returned by pos-visible-in-window-p. (Bug#19473)
src/xdisp.c (pos_visible_p): Fix up the X coordinate for right-to-left screen lines.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c23
2 files changed, 24 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 94f07c88c0f..21303f27654 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12014-12-30 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (pos_visible_p): Fix up the X coordinate for
4 right-to-left screen lines. (Bug#19473)
5
12014-12-28 Eli Zaretskii <eliz@gnu.org> 62014-12-28 Eli Zaretskii <eliz@gnu.org>
2 7
3 * w32proc.c (Fw32_get_codepage_charset): Doc fix. (Bug#19458) 8 * w32proc.c (Fw32_get_codepage_charset): Doc fix. (Bug#19458)
diff --git a/src/xdisp.c b/src/xdisp.c
index 173df5d011b..f0a851acb55 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1403,6 +1403,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1403 struct text_pos top; 1403 struct text_pos top;
1404 int visible_p = 0; 1404 int visible_p = 0;
1405 struct buffer *old_buffer = NULL; 1405 struct buffer *old_buffer = NULL;
1406 bool r2l = false;
1406 1407
1407 if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) 1408 if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w))))
1408 return visible_p; 1409 return visible_p;
@@ -1688,6 +1689,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1688 *rowh = max (0, (min (bottom_y, it.last_visible_y) 1689 *rowh = max (0, (min (bottom_y, it.last_visible_y)
1689 - max (top_y, window_top_y))); 1690 - max (top_y, window_top_y)));
1690 *vpos = it.vpos; 1691 *vpos = it.vpos;
1692 if (it.bidi_it.paragraph_dir == R2L)
1693 r2l = true;
1691 } 1694 }
1692 } 1695 }
1693 else 1696 else
@@ -1717,6 +1720,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1717 - max (it2.current_y, 1720 - max (it2.current_y,
1718 WINDOW_HEADER_LINE_HEIGHT (w)))); 1721 WINDOW_HEADER_LINE_HEIGHT (w))));
1719 *vpos = it2.vpos; 1722 *vpos = it2.vpos;
1723 if (it2.bidi_it.paragraph_dir == R2L)
1724 r2l = true;
1720 } 1725 }
1721 else 1726 else
1722 bidi_unshelve_cache (it2data, 1); 1727 bidi_unshelve_cache (it2data, 1);
@@ -1726,10 +1731,20 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1726 if (old_buffer) 1731 if (old_buffer)
1727 set_buffer_internal_1 (old_buffer); 1732 set_buffer_internal_1 (old_buffer);
1728 1733
1729 if (visible_p && w->hscroll > 0) 1734 if (visible_p)
1730 *x -= 1735 {
1731 window_hscroll_limited (w, WINDOW_XFRAME (w)) 1736 if (w->hscroll > 0)
1732 * WINDOW_FRAME_COLUMN_WIDTH (w); 1737 *x -=
1738 window_hscroll_limited (w, WINDOW_XFRAME (w))
1739 * WINDOW_FRAME_COLUMN_WIDTH (w);
1740 /* For lines in an R2L paragraph, we need to mirror the X pixel
1741 coordinate wrt the text area. For the reasons, see the
1742 commentary in buffer_posn_from_coords and the explanation of
1743 the geometry used by the move_it_* functions at the end of
1744 the large commentart near the beginning of this file. */
1745 if (r2l)
1746 *x = window_box_width (w, TEXT_AREA) - *x - 1;
1747 }
1733 1748
1734#if 0 1749#if 0
1735 /* Debugging code. */ 1750 /* Debugging code. */