diff options
| author | Eli Zaretskii | 2010-05-01 16:39:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-05-01 16:39:44 +0300 |
| commit | 166e930d762b6f8f9c40d61678d4dac073d5a42e (patch) | |
| tree | 06f2c18225b8edeb81335046d95f8e6bc7e9e464 | |
| parent | 017ea8192415cbd091cd53075b168fa702c3b922 (diff) | |
| download | emacs-166e930d762b6f8f9c40d61678d4dac073d5a42e.tar.gz emacs-166e930d762b6f8f9c40d61678d4dac073d5a42e.zip | |
Fix display of truncated R2L lines on a TTY.
xdisp.c (display_line): Fix prepending of truncation glyphs to R2L rows.
(insert_left_trunc_glyphs): Support addition of left truncation glyphs
to R2L rows.
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 71 |
2 files changed, 59 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a5548ff16fc..7becf77dde9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | (display_line): Use it. | 4 | (display_line): Use it. |
| 5 | (extend_face_to_end_of_line): In almost-filled rows, extend only | 5 | (extend_face_to_end_of_line): In almost-filled rows, extend only |
| 6 | if the row is R2L and not continued. | 6 | if the row is R2L and not continued. |
| 7 | (display_line): Fix prepending of truncation glyphs to R2L rows. | ||
| 8 | (insert_left_trunc_glyphs): Support addition of left truncation | ||
| 9 | glyphs to R2L rows. | ||
| 7 | 10 | ||
| 8 | 2010-04-27 Eli Zaretskii <eliz@gnu.org> | 11 | 2010-04-27 Eli Zaretskii <eliz@gnu.org> |
| 9 | 12 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 45e6b83ec29..6d0683ba566 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -16739,24 +16739,61 @@ insert_left_trunc_glyphs (it) | |||
| 16739 | produce_special_glyphs (&truncate_it, IT_TRUNCATION); | 16739 | produce_special_glyphs (&truncate_it, IT_TRUNCATION); |
| 16740 | 16740 | ||
| 16741 | /* Overwrite glyphs from IT with truncation glyphs. */ | 16741 | /* Overwrite glyphs from IT with truncation glyphs. */ |
| 16742 | from = truncate_it.glyph_row->glyphs[TEXT_AREA]; | 16742 | if (!it->glyph_row->reversed_p) |
| 16743 | end = from + truncate_it.glyph_row->used[TEXT_AREA]; | ||
| 16744 | to = it->glyph_row->glyphs[TEXT_AREA]; | ||
| 16745 | toend = to + it->glyph_row->used[TEXT_AREA]; | ||
| 16746 | |||
| 16747 | while (from < end) | ||
| 16748 | *to++ = *from++; | ||
| 16749 | |||
| 16750 | /* There may be padding glyphs left over. Overwrite them too. */ | ||
| 16751 | while (to < toend && CHAR_GLYPH_PADDING_P (*to)) | ||
| 16752 | { | 16743 | { |
| 16753 | from = truncate_it.glyph_row->glyphs[TEXT_AREA]; | 16744 | from = truncate_it.glyph_row->glyphs[TEXT_AREA]; |
| 16745 | end = from + truncate_it.glyph_row->used[TEXT_AREA]; | ||
| 16746 | to = it->glyph_row->glyphs[TEXT_AREA]; | ||
| 16747 | toend = to + it->glyph_row->used[TEXT_AREA]; | ||
| 16748 | |||
| 16754 | while (from < end) | 16749 | while (from < end) |
| 16755 | *to++ = *from++; | 16750 | *to++ = *from++; |
| 16751 | |||
| 16752 | /* There may be padding glyphs left over. Overwrite them too. */ | ||
| 16753 | while (to < toend && CHAR_GLYPH_PADDING_P (*to)) | ||
| 16754 | { | ||
| 16755 | from = truncate_it.glyph_row->glyphs[TEXT_AREA]; | ||
| 16756 | while (from < end) | ||
| 16757 | *to++ = *from++; | ||
| 16758 | } | ||
| 16759 | |||
| 16760 | if (to > toend) | ||
| 16761 | it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA]; | ||
| 16756 | } | 16762 | } |
| 16763 | else | ||
| 16764 | { | ||
| 16765 | /* In R2L rows, overwrite the last (rightmost) glyphs, and do | ||
| 16766 | that back to front. */ | ||
| 16767 | end = truncate_it.glyph_row->glyphs[TEXT_AREA]; | ||
| 16768 | from = end + truncate_it.glyph_row->used[TEXT_AREA] - 1; | ||
| 16769 | toend = it->glyph_row->glyphs[TEXT_AREA]; | ||
| 16770 | to = toend + it->glyph_row->used[TEXT_AREA] - 1; | ||
| 16771 | |||
| 16772 | while (from >= end && to >= toend) | ||
| 16773 | *to-- = *from--; | ||
| 16774 | while (to >= toend && CHAR_GLYPH_PADDING_P (*to)) | ||
| 16775 | { | ||
| 16776 | from = | ||
| 16777 | truncate_it.glyph_row->glyphs[TEXT_AREA] | ||
| 16778 | + truncate_it.glyph_row->used[TEXT_AREA] - 1; | ||
| 16779 | while (from >= end && to >= toend) | ||
| 16780 | *to-- = *from--; | ||
| 16781 | } | ||
| 16782 | if (from >= end) | ||
| 16783 | { | ||
| 16784 | /* Need to free some room before prepending additional | ||
| 16785 | glyphs. */ | ||
| 16786 | int move_by = from - end + 1; | ||
| 16787 | struct glyph *g0 = it->glyph_row->glyphs[TEXT_AREA]; | ||
| 16788 | struct glyph *g = g0 + it->glyph_row->used[TEXT_AREA] - 1; | ||
| 16757 | 16789 | ||
| 16758 | if (to > toend) | 16790 | for ( ; g >= g0; g--) |
| 16759 | it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA]; | 16791 | g[move_by] = *g; |
| 16792 | while (from >= end) | ||
| 16793 | *to-- = *from--; | ||
| 16794 | it->glyph_row->used[TEXT_AREA] += move_by; | ||
| 16795 | } | ||
| 16796 | } | ||
| 16760 | } | 16797 | } |
| 16761 | 16798 | ||
| 16762 | 16799 | ||
| @@ -17938,10 +17975,14 @@ display_line (it) | |||
| 17938 | for (i = 0; i < row->used[TEXT_AREA]; i++) | 17975 | for (i = 0; i < row->used[TEXT_AREA]; i++) |
| 17939 | if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) | 17976 | if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) |
| 17940 | break; | 17977 | break; |
| 17941 | /* Remove padding glyphs at the front of ROW, to | 17978 | /* Remove any padding glyphs at the front of ROW, to |
| 17942 | make room for the truncation glyphs we will be | 17979 | make room for the truncation glyphs we will be |
| 17943 | adding below. */ | 17980 | adding below. The loop below always inserts at |
| 17944 | unproduce_glyphs (it, i); | 17981 | least one truncation glyph, so also remove the |
| 17982 | last glyph added to ROW. */ | ||
| 17983 | unproduce_glyphs (it, i + 1); | ||
| 17984 | /* Adjust i for the loop below. */ | ||
| 17985 | i = row->used[TEXT_AREA] - (i + 1); | ||
| 17945 | } | 17986 | } |
| 17946 | 17987 | ||
| 17947 | for (n = row->used[TEXT_AREA]; i < n; ++i) | 17988 | for (n = row->used[TEXT_AREA]; i < n; ++i) |