diff options
| author | Eli Zaretskii | 2012-07-12 22:55:01 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-07-12 22:55:01 +0300 |
| commit | 5a97981785998a7f1a9b8f0bc34e644e733ae5d2 (patch) | |
| tree | c5632ce4a00cbbdd97d42372582580f8d12143ae /src | |
| parent | 3e91a053d994909287c300dc93e1f37ce6f8e44e (diff) | |
| download | emacs-5a97981785998a7f1a9b8f0bc34e644e733ae5d2.tar.gz emacs-5a97981785998a7f1a9b8f0bc34e644e733ae5d2.zip | |
Improve fix for bug #11832 with truncated/continued lines w/o margins.
src/xdisp.c (insert_left_trunc_glyphs): Fix incorrect size in
memmove call that removes glyphs covered by the left truncation
glyph. Improve commentary.
(display_line): Fix display of continuation glyphs on GUI frames
when the right fringe is turned off and variable-size fonts are
used in the window. Move the code that appends a stretch glyph to
produce_special_glyphs, so that it could be used for truncation
and continuation glyphs alike.
(produce_special_glyphs) [HAVE_WINDOW_SYSTEM]: Produce a stretch
glyph of a suitably computed width, to align the special glyphs at
the window margin. Code moved from display_line.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/xdisp.c | 87 |
2 files changed, 62 insertions, 39 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 14428f427d5..4d4f7e006fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2012-07-12 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (insert_left_trunc_glyphs): Fix incorrect size in | ||
| 4 | memmove call that removes glyphs covered by the left truncation | ||
| 5 | glyph. Improve commentary. | ||
| 6 | (display_line): Fix display of continuation glyphs on GUI frames | ||
| 7 | when the right fringe is turned off and variable-size fonts are | ||
| 8 | used in the window. Move the code that appends a stretch glyph to | ||
| 9 | produce_special_glyphs, so that it could be used for truncation | ||
| 10 | and continuation glyphs alike. | ||
| 11 | (produce_special_glyphs) [HAVE_WINDOW_SYSTEM]: Produce a stretch | ||
| 12 | glyph of a suitably computed width, to align the special glyphs at | ||
| 13 | the window margin. Code moved from display_line. (Bug#11832) | ||
| 14 | |||
| 1 | 2012-07-12 Glenn Morris <rgm@gnu.org> | 15 | 2012-07-12 Glenn Morris <rgm@gnu.org> |
| 2 | 16 | ||
| 3 | * s/gnu-linux.h (UNIX98_PTYS): Let configure set it. | 17 | * s/gnu-linux.h (UNIX98_PTYS): Let configure set it. |
diff --git a/src/xdisp.c b/src/xdisp.c index 6af0dd6e8a3..a03de37dba9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -18257,13 +18257,12 @@ insert_left_trunc_glyphs (struct it *it) | |||
| 18257 | struct glyph *g = to; | 18257 | struct glyph *g = to; |
| 18258 | short used; | 18258 | short used; |
| 18259 | 18259 | ||
| 18260 | while (g < toend && it->glyph_row->x + w < 0) | 18260 | /* The first glyph could be partially visible, in which case |
| 18261 | { | 18261 | it->glyph_row->x will be negative. But we want the left |
| 18262 | w += g->pixel_width; | 18262 | truncation glyphs to be aligned at the left margin of the |
| 18263 | ++g; | 18263 | window, so we override the x coordinate at which the row |
| 18264 | } | 18264 | will begin. */ |
| 18265 | it->glyph_row->x = 0; | 18265 | it->glyph_row->x = 0; |
| 18266 | w = 0; | ||
| 18267 | while (g < toend && w < it->truncation_pixel_width) | 18266 | while (g < toend && w < it->truncation_pixel_width) |
| 18268 | { | 18267 | { |
| 18269 | w += g->pixel_width; | 18268 | w += g->pixel_width; |
| @@ -18271,7 +18270,7 @@ insert_left_trunc_glyphs (struct it *it) | |||
| 18271 | } | 18270 | } |
| 18272 | if (g - to - tused > 0) | 18271 | if (g - to - tused > 0) |
| 18273 | { | 18272 | { |
| 18274 | memmove (to + tused, g, toend - g); | 18273 | memmove (to + tused, g, (toend - g) * sizeof(*g)); |
| 18275 | it->glyph_row->used[TEXT_AREA] -= g - to - tused; | 18274 | it->glyph_row->used[TEXT_AREA] -= g - to - tused; |
| 18276 | } | 18275 | } |
| 18277 | used = it->glyph_row->used[TEXT_AREA]; | 18276 | used = it->glyph_row->used[TEXT_AREA]; |
| @@ -19616,6 +19615,8 @@ display_line (struct it *it) | |||
| 19616 | row->used[TEXT_AREA] = n_glyphs_before + i; | 19615 | row->used[TEXT_AREA] = n_glyphs_before + i; |
| 19617 | 19616 | ||
| 19618 | /* Display continuation glyphs. */ | 19617 | /* Display continuation glyphs. */ |
| 19618 | it->current_x = x_before; | ||
| 19619 | it->continuation_lines_width += x; | ||
| 19619 | if (!FRAME_WINDOW_P (it->f) | 19620 | if (!FRAME_WINDOW_P (it->f) |
| 19620 | || (row->reversed_p | 19621 | || (row->reversed_p |
| 19621 | ? WINDOW_LEFT_FRINGE_WIDTH (it->w) | 19622 | ? WINDOW_LEFT_FRINGE_WIDTH (it->w) |
| @@ -19623,8 +19624,6 @@ display_line (struct it *it) | |||
| 19623 | produce_special_glyphs (it, IT_CONTINUATION); | 19624 | produce_special_glyphs (it, IT_CONTINUATION); |
| 19624 | row->continued_p = 1; | 19625 | row->continued_p = 1; |
| 19625 | 19626 | ||
| 19626 | it->current_x = x_before; | ||
| 19627 | it->continuation_lines_width += x; | ||
| 19628 | extend_face_to_end_of_line (it); | 19627 | extend_face_to_end_of_line (it); |
| 19629 | 19628 | ||
| 19630 | if (nglyphs > 1 && i > 0) | 19629 | if (nglyphs > 1 && i > 0) |
| @@ -19768,38 +19767,11 @@ display_line (struct it *it) | |||
| 19768 | produce_special_glyphs (it, IT_TRUNCATION); | 19767 | produce_special_glyphs (it, IT_TRUNCATION); |
| 19769 | } | 19768 | } |
| 19770 | } | 19769 | } |
| 19771 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 19772 | else | 19770 | else |
| 19773 | { | 19771 | { |
| 19774 | /* On a GUI frame, when the right fringe (left | ||
| 19775 | fringe for R2L rows) is turned off, we produce | ||
| 19776 | truncation glyphs preceded by a stretch glyph | ||
| 19777 | whose width is computed such that the truncation | ||
| 19778 | glyphs are aligned at the window margin, even | ||
| 19779 | when very different fonts are used in different | ||
| 19780 | glyph rows. */ | ||
| 19781 | int stretch_width = it->last_visible_x - it->current_x; | ||
| 19782 | |||
| 19783 | row->used[TEXT_AREA] = i; | 19772 | row->used[TEXT_AREA] = i; |
| 19784 | if (stretch_width > 0) | ||
| 19785 | { | ||
| 19786 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | ||
| 19787 | struct font *font = | ||
| 19788 | face->font ? face->font : FRAME_FONT (it->f); | ||
| 19789 | int stretch_ascent = | ||
| 19790 | (((it->ascent + it->descent) | ||
| 19791 | * FONT_BASE (font)) / FONT_HEIGHT (font)); | ||
| 19792 | struct text_pos saved_pos = it->position; | ||
| 19793 | |||
| 19794 | memset (&it->position, 0, sizeof it->position); | ||
| 19795 | append_stretch_glyph (it, make_number (0), stretch_width, | ||
| 19796 | it->ascent + it->descent, | ||
| 19797 | stretch_ascent); | ||
| 19798 | it->position = saved_pos; | ||
| 19799 | } | ||
| 19800 | produce_special_glyphs (it, IT_TRUNCATION); | 19773 | produce_special_glyphs (it, IT_TRUNCATION); |
| 19801 | } | 19774 | } |
| 19802 | #endif | ||
| 19803 | } | 19775 | } |
| 19804 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 19776 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 19805 | { | 19777 | { |
| @@ -24215,9 +24187,6 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 24215 | GLYPH glyph; | 24187 | GLYPH glyph; |
| 24216 | 24188 | ||
| 24217 | temp_it = *it; | 24189 | temp_it = *it; |
| 24218 | temp_it.dp = NULL; | ||
| 24219 | temp_it.what = IT_CHARACTER; | ||
| 24220 | temp_it.len = 1; | ||
| 24221 | temp_it.object = make_number (0); | 24190 | temp_it.object = make_number (0); |
| 24222 | memset (&temp_it.current, 0, sizeof temp_it.current); | 24191 | memset (&temp_it.current, 0, sizeof temp_it.current); |
| 24223 | 24192 | ||
| @@ -24251,6 +24220,46 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 24251 | else | 24220 | else |
| 24252 | abort (); | 24221 | abort (); |
| 24253 | 24222 | ||
| 24223 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24224 | /* On a GUI frame, when the right fringe (left fringe for R2L rows) | ||
| 24225 | is turned off, we precede the truncation/continuation glyphs by a | ||
| 24226 | stretch glyph whose width is computed such that these special | ||
| 24227 | glyphs are aligned at the window margin, even when very different | ||
| 24228 | fonts are used in different glyph rows. */ | ||
| 24229 | if (FRAME_WINDOW_P (temp_it.f) | ||
| 24230 | /* init_iterator calls this with it->glyph_row == NULL, and it | ||
| 24231 | wants only the pixel width of the truncation/continuation | ||
| 24232 | glyphs. */ | ||
| 24233 | && temp_it.glyph_row | ||
| 24234 | /* insert_left_trunc_glyphs calls us at the beginning of the | ||
| 24235 | row, and it has its own calculation of the stretch glyph | ||
| 24236 | width. */ | ||
| 24237 | && temp_it.glyph_row->used[TEXT_AREA] > 0 | ||
| 24238 | && (temp_it.glyph_row->reversed_p | ||
| 24239 | ? WINDOW_LEFT_FRINGE_WIDTH (temp_it.w) | ||
| 24240 | : WINDOW_RIGHT_FRINGE_WIDTH (temp_it.w)) == 0) | ||
| 24241 | { | ||
| 24242 | int stretch_width = temp_it.last_visible_x - temp_it.current_x; | ||
| 24243 | |||
| 24244 | if (stretch_width > 0) | ||
| 24245 | { | ||
| 24246 | struct face *face = FACE_FROM_ID (temp_it.f, temp_it.face_id); | ||
| 24247 | struct font *font = | ||
| 24248 | face->font ? face->font : FRAME_FONT (temp_it.f); | ||
| 24249 | int stretch_ascent = | ||
| 24250 | (((temp_it.ascent + temp_it.descent) | ||
| 24251 | * FONT_BASE (font)) / FONT_HEIGHT (font)); | ||
| 24252 | |||
| 24253 | append_stretch_glyph (&temp_it, make_number (0), stretch_width, | ||
| 24254 | temp_it.ascent + temp_it.descent, | ||
| 24255 | stretch_ascent); | ||
| 24256 | } | ||
| 24257 | } | ||
| 24258 | #endif | ||
| 24259 | |||
| 24260 | temp_it.dp = NULL; | ||
| 24261 | temp_it.what = IT_CHARACTER; | ||
| 24262 | temp_it.len = 1; | ||
| 24254 | temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); | 24263 | temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); |
| 24255 | temp_it.face_id = GLYPH_FACE (glyph); | 24264 | temp_it.face_id = GLYPH_FACE (glyph); |
| 24256 | temp_it.len = CHAR_BYTES (temp_it.c); | 24265 | temp_it.len = CHAR_BYTES (temp_it.c); |