aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-09-15 18:25:54 +0300
committerEli Zaretskii2014-09-15 18:25:54 +0300
commit6b682d2b398b241fe32fe98104ef0a58ec20bde9 (patch)
tree462d45d32600278c8f703a21eeb2ef478525a806 /src
parentd4dc0e1691a15efd1ea0a8793cf889e683a37933 (diff)
downloademacs-6b682d2b398b241fe32fe98104ef0a58ec20bde9.tar.gz
emacs-6b682d2b398b241fe32fe98104ef0a58ec20bde9.zip
Fix display of R2L lines in partial-width windows.
src/xdisp.c (init_iterator): Don't use it->bidi_p before it is assigned the correct value. (extend_face_to_end_of_line): Account for truncation and continuation glyphs in R2L rows when one of the fringes is not displayed. (display_line): Don't assign negative X offset to a row if we are going to produce a truncation glyph for it. When handling truncated R2L rows, consider the width of the left fringe instead of the right one. (produce_special_glyphs): Fix bogus assignments.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/xdisp.c56
2 files changed, 57 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c32b4c44988..09b606d1dd5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12014-09-15 Eli Zaretskii <eliz@gnu.org>
2
3 Fix display of R2L lines in partial-width windows.
4 * xdisp.c (init_iterator): Don't use it->bidi_p before it is
5 assigned the correct value.
6 (extend_face_to_end_of_line): Account for truncation and
7 continuation glyphs in R2L rows when one of the fringes is not
8 displayed.
9 (display_line): Don't assign negative X offset to a row if we are
10 going to produce a truncation glyph for it. When handling
11 truncated R2L rows, consider the width of the left fringe instead
12 of the right one.
13 (produce_special_glyphs): Fix bogus assignments.
14
12014-09-14 Eli Zaretskii <eliz@gnu.org> 152014-09-14 Eli Zaretskii <eliz@gnu.org>
2 16
3 * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of 17 * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of
diff --git a/src/xdisp.c b/src/xdisp.c
index 6b327c84290..909349b81b3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2994,12 +2994,8 @@ init_iterator (struct it *it, struct window *w,
2994 2994
2995 /* If we truncate lines, leave room for the truncation glyph(s) at 2995 /* If we truncate lines, leave room for the truncation glyph(s) at
2996 the right margin. Otherwise, leave room for the continuation 2996 the right margin. Otherwise, leave room for the continuation
2997 glyph(s). Done only if the window has no fringes. Since we 2997 glyph(s). Done only if the window has no right fringe. */
2998 don't know at this point whether there will be any R2L lines in 2998 if (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0)
2999 the window, we reserve space for truncation/continuation glyphs
3000 even if only one of the fringes is absent. */
3001 if (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0
3002 || (it->bidi_p && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0))
3003 { 2999 {
3004 if (it->line_wrap == TRUNCATE) 3000 if (it->line_wrap == TRUNCATE)
3005 it->last_visible_x -= it->truncation_pixel_width; 3001 it->last_visible_x -= it->truncation_pixel_width;
@@ -3064,6 +3060,19 @@ init_iterator (struct it *it, struct window *w,
3064 iterator. */ 3060 iterator. */
3065 if (it->bidi_p) 3061 if (it->bidi_p)
3066 { 3062 {
3063 /* Since we don't know at this point whether there will be
3064 any R2L lines in the window, we reserve space for
3065 truncation/continuation glyphs even if only the left
3066 fringe is absent. */
3067 if (base_face_id == DEFAULT_FACE_ID
3068 && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0
3069 && WINDOW_RIGHT_FRINGE_WIDTH (it->w) != 0)
3070 {
3071 if (it->line_wrap == TRUNCATE)
3072 it->last_visible_x -= it->truncation_pixel_width;
3073 else
3074 it->last_visible_x -= it->continuation_pixel_width;
3075 }
3067 /* Note the paragraph direction that this buffer wants to 3076 /* Note the paragraph direction that this buffer wants to
3068 use. */ 3077 use. */
3069 if (EQ (BVAR (current_buffer, bidi_paragraph_direction), 3078 if (EQ (BVAR (current_buffer, bidi_paragraph_direction),
@@ -19334,7 +19343,18 @@ extend_face_to_end_of_line (struct it *it)
19334 19343
19335 for (row_width = 0, g = row_start; g < row_end; g++) 19344 for (row_width = 0, g = row_start; g < row_end; g++)
19336 row_width += g->pixel_width; 19345 row_width += g->pixel_width;
19337 stretch_width = window_box_width (it->w, TEXT_AREA) - row_width; 19346
19347 /* FIXME: There are various minor display glitches in R2L
19348 rows when only one of the fringes is missing. The
19349 strange condition below produces the least bad effect. */
19350 if ((WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0)
19351 == (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0)
19352 || WINDOW_RIGHT_FRINGE_WIDTH (it->w) != 0)
19353 stretch_width = window_box_width (it->w, TEXT_AREA);
19354 else
19355 stretch_width = it->last_visible_x - it->first_visible_x;
19356 stretch_width -= row_width;
19357
19338 if (stretch_width > 0) 19358 if (stretch_width > 0)
19339 { 19359 {
19340 stretch_ascent = 19360 stretch_ascent =
@@ -20475,9 +20495,17 @@ display_line (struct it *it)
20475 /* When the last glyph of an R2L row only fits 20495 /* When the last glyph of an R2L row only fits
20476 partially on the line, we need to set row->x to a 20496 partially on the line, we need to set row->x to a
20477 negative offset, so that the leftmost glyph is 20497 negative offset, so that the leftmost glyph is
20478 the one that is partially visible. */ 20498 the one that is partially visible. But if we are
20479 if (row->reversed_p && new_x > it->last_visible_x) 20499 going to produce the truncation glyph, this will
20480 row->x = it->last_visible_x - new_x; 20500 be taken care of in produce_special_glyphs. */
20501 if (row->reversed_p
20502 && new_x > it->last_visible_x
20503 && !(it->line_wrap == TRUNCATE
20504 && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0))
20505 {
20506 eassert (FRAME_WINDOW_P (it->f));
20507 row->x = it->last_visible_x - new_x;
20508 }
20481 } 20509 }
20482 else 20510 else
20483 { 20511 {
@@ -20551,7 +20579,10 @@ display_line (struct it *it)
20551 that they are cropped at the right edge of the 20579 that they are cropped at the right edge of the
20552 window, so an image glyph will always end exactly at 20580 window, so an image glyph will always end exactly at
20553 last_visible_x, even if there's no right fringe. */ 20581 last_visible_x, even if there's no right fringe. */
20554 && (WINDOW_RIGHT_FRINGE_WIDTH (it->w) || it->what == IT_IMAGE)) 20582 && ((row->reversed_p
20583 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
20584 : WINDOW_RIGHT_FRINGE_WIDTH (it->w))
20585 || it->what == IT_IMAGE))
20555 ? (it->current_x >= it->last_visible_x) 20586 ? (it->current_x >= it->last_visible_x)
20556 : (it->current_x > it->last_visible_x))) 20587 : (it->current_x > it->last_visible_x)))
20557 { 20588 {
@@ -25719,14 +25750,13 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
25719 25750
25720 temp_it.dp = NULL; 25751 temp_it.dp = NULL;
25721 temp_it.what = IT_CHARACTER; 25752 temp_it.what = IT_CHARACTER;
25722 temp_it.len = 1;
25723 temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); 25753 temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph);
25724 temp_it.face_id = GLYPH_FACE (glyph); 25754 temp_it.face_id = GLYPH_FACE (glyph);
25725 temp_it.len = CHAR_BYTES (temp_it.c); 25755 temp_it.len = CHAR_BYTES (temp_it.c);
25726 25756
25727 PRODUCE_GLYPHS (&temp_it); 25757 PRODUCE_GLYPHS (&temp_it);
25728 it->pixel_width = temp_it.pixel_width; 25758 it->pixel_width = temp_it.pixel_width;
25729 it->nglyphs = temp_it.pixel_width; 25759 it->nglyphs = temp_it.nglyphs;
25730} 25760}
25731 25761
25732#ifdef HAVE_WINDOW_SYSTEM 25762#ifdef HAVE_WINDOW_SYSTEM