summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-08-01 12:39:04 +0300
committerEli Zaretskii <eliz@gnu.org>2014-08-01 12:39:04 +0300
commita1767506c07b1c6b89ad9d837b457f3bbd6a5e6e (patch)
tree8363c876aaead95bdc7ac89546e0b695e9e7ee93
parentf0f377774b3db7a8c0c3b1e28651876179fdfe2b (diff)
downloademacs-a1767506c07b1c6b89ad9d837b457f3bbd6a5e6e.tar.gz
Fix display of R2L lines when the last character fits only partially.
See http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00476.html for the details. src/xdisp.c (extend_face_to_end_of_line): If the last glyph of an R2L row is visible only partially, give the row a negative x offset. (display_line): Fix the calculation of the glyph whose pixel width is used to decide whether the last produced glyph fits on the line. When the last glyph fits only partially, give the row a negative x offset.
-rw-r--r--src/ChangeLog13
-rw-r--r--src/xdisp.c20
2 files changed, 32 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9d5e7687110..13415734c79 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
+2014-08-01 Eli Zaretskii <eliz@gnu.org>
+
+ Fix display of R2L lines when the last character fits only partially.
+ See http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00476.html
+ for the details.
+ * xdisp.c (extend_face_to_end_of_line): If the last glyph of an
+ R2L row is visible only partially, give the row a negative x
+ offset.
+ (display_line): Fix the calculation of the glyph whose pixel width
+ is used to decide whether the last produced glyph fits on the
+ line. When the last glyph fits only partially, give the row a
+ negative x offset.
+
2014-07-29 Eli Zaretskii <eliz@gnu.org>
Fix hscroll of R2L lines that begin with a TAB or another wide glyph.
diff --git a/src/xdisp.c b/src/xdisp.c
index e9e8ad6594e..776e4d000ee 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19316,6 +19316,12 @@ extend_face_to_end_of_line (struct it *it)
it->face_id = saved_face_id;
it->start_of_box_run_p = saved_box_start;
}
+ /* If stretch_width comes out negative, it means that the
+ last glyph is only partially visible. In R2L rows, we
+ want the leftmost glyph to be partially visible, so we
+ need to give the row the corresponding left offset. */
+ if (stretch_width < 0)
+ it->glyph_row->x = stretch_width;
}
#endif /* HAVE_WINDOW_SYSTEM */
}
@@ -20207,7 +20213,13 @@ display_line (struct it *it)
for (i = 0; i < nglyphs; ++i, x = new_x)
{
- glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i;
+ /* Identify the glyphs added by the last call to
+ PRODUCE_GLYPHS. In R2L rows, they are prepended to
+ the previous glyphs. */
+ if (!row->reversed_p)
+ glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i;
+ else
+ glyph = row->glyphs[TEXT_AREA] + nglyphs - 1 - i;
new_x = x + glyph->pixel_width;
if (/* Lines are continued. */
@@ -20415,6 +20427,12 @@ display_line (struct it *it)
suitable change to the stretch glyph that is
the leftmost glyph of the line. */
row->x = x - it->first_visible_x;
+ /* When the last glyph of an R2L row only fits
+ partially on the line, we need to set row->x to a
+ negative offset, so that the leftmost glyph is
+ the one that is partially visible. */
+ if (row->reversed_p && new_x > it->last_visible_x)
+ row->x = it->last_visible_x - new_x;
}
else
{