+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.
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 */
}
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. */
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
{