aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-08-01 12:39:04 +0300
committerEli Zaretskii2014-08-01 12:39:04 +0300
commita1767506c07b1c6b89ad9d837b457f3bbd6a5e6e (patch)
tree8363c876aaead95bdc7ac89546e0b695e9e7ee93 /src
parentf0f377774b3db7a8c0c3b1e28651876179fdfe2b (diff)
downloademacs-a1767506c07b1c6b89ad9d837b457f3bbd6a5e6e.tar.gz
emacs-a1767506c07b1c6b89ad9d837b457f3bbd6a5e6e.zip
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.
Diffstat (limited to 'src')
-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 @@
12014-08-01 Eli Zaretskii <eliz@gnu.org>
2
3 Fix display of R2L lines when the last character fits only partially.
4 See http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00476.html
5 for the details.
6 * xdisp.c (extend_face_to_end_of_line): If the last glyph of an
7 R2L row is visible only partially, give the row a negative x
8 offset.
9 (display_line): Fix the calculation of the glyph whose pixel width
10 is used to decide whether the last produced glyph fits on the
11 line. When the last glyph fits only partially, give the row a
12 negative x offset.
13
12014-07-29 Eli Zaretskii <eliz@gnu.org> 142014-07-29 Eli Zaretskii <eliz@gnu.org>
2 15
3 Fix hscroll of R2L lines that begin with a TAB or another wide glyph. 16 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)
19316 it->face_id = saved_face_id; 19316 it->face_id = saved_face_id;
19317 it->start_of_box_run_p = saved_box_start; 19317 it->start_of_box_run_p = saved_box_start;
19318 } 19318 }
19319 /* If stretch_width comes out negative, it means that the
19320 last glyph is only partially visible. In R2L rows, we
19321 want the leftmost glyph to be partially visible, so we
19322 need to give the row the corresponding left offset. */
19323 if (stretch_width < 0)
19324 it->glyph_row->x = stretch_width;
19319 } 19325 }
19320#endif /* HAVE_WINDOW_SYSTEM */ 19326#endif /* HAVE_WINDOW_SYSTEM */
19321 } 19327 }
@@ -20207,7 +20213,13 @@ display_line (struct it *it)
20207 20213
20208 for (i = 0; i < nglyphs; ++i, x = new_x) 20214 for (i = 0; i < nglyphs; ++i, x = new_x)
20209 { 20215 {
20210 glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; 20216 /* Identify the glyphs added by the last call to
20217 PRODUCE_GLYPHS. In R2L rows, they are prepended to
20218 the previous glyphs. */
20219 if (!row->reversed_p)
20220 glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i;
20221 else
20222 glyph = row->glyphs[TEXT_AREA] + nglyphs - 1 - i;
20211 new_x = x + glyph->pixel_width; 20223 new_x = x + glyph->pixel_width;
20212 20224
20213 if (/* Lines are continued. */ 20225 if (/* Lines are continued. */
@@ -20415,6 +20427,12 @@ display_line (struct it *it)
20415 suitable change to the stretch glyph that is 20427 suitable change to the stretch glyph that is
20416 the leftmost glyph of the line. */ 20428 the leftmost glyph of the line. */
20417 row->x = x - it->first_visible_x; 20429 row->x = x - it->first_visible_x;
20430 /* When the last glyph of an R2L row only fits
20431 partially on the line, we need to set row->x to a
20432 negative offset, so that the leftmost glyph is
20433 the one that is partially visible. */
20434 if (row->reversed_p && new_x > it->last_visible_x)
20435 row->x = it->last_visible_x - new_x;
20418 } 20436 }
20419 else 20437 else
20420 { 20438 {