diff options
| author | Eli Zaretskii | 2010-03-31 17:28:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-03-31 17:28:16 +0300 |
| commit | 52c3078336b724f3d657e2405136f66524483ecb (patch) | |
| tree | 85311157792d2bf1973a1a1436f0a698984746a2 /src | |
| parent | d35ad51f14527024845454830ae458bd7e6fe7dd (diff) | |
| download | emacs-52c3078336b724f3d657e2405136f66524483ecb.tar.gz emacs-52c3078336b724f3d657e2405136f66524483ecb.zip | |
Fix highlight of trailing whitespace is right-to-left lines.
xdisp.c (highlight_trailing_whitespace): Support highlight of
trailing whitespace in right-to-left rows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 52 |
2 files changed, 46 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9d70a3327b6..3c43c80764a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-03-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (highlight_trailing_whitespace): Support highlight of | ||
| 4 | trailing whitespace in right-to-left rows. | ||
| 5 | |||
| 1 | 2010-03-31 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2010-03-31 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | Get rid of the direct_output optimizations. | 8 | Get rid of the direct_output optimizations. |
diff --git a/src/xdisp.c b/src/xdisp.c index b3aaa52e2e5..709ff5f6d68 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -16868,19 +16868,37 @@ highlight_trailing_whitespace (f, row) | |||
| 16868 | struct glyph *start = row->glyphs[TEXT_AREA]; | 16868 | struct glyph *start = row->glyphs[TEXT_AREA]; |
| 16869 | struct glyph *glyph = start + used - 1; | 16869 | struct glyph *glyph = start + used - 1; |
| 16870 | 16870 | ||
| 16871 | if (row->reversed_p) | ||
| 16872 | { | ||
| 16873 | /* Right-to-left rows need to be processed in the opposite | ||
| 16874 | direction, so swap the edge pointers. */ | ||
| 16875 | glyph = start; | ||
| 16876 | start = row->glyphs[TEXT_AREA] + used - 1; | ||
| 16877 | } | ||
| 16878 | |||
| 16871 | /* Skip over glyphs inserted to display the cursor at the | 16879 | /* Skip over glyphs inserted to display the cursor at the |
| 16872 | end of a line, for extending the face of the last glyph | 16880 | end of a line, for extending the face of the last glyph |
| 16873 | to the end of the line on terminals, and for truncation | 16881 | to the end of the line on terminals, and for truncation |
| 16874 | and continuation glyphs. */ | 16882 | and continuation glyphs. */ |
| 16875 | while (glyph >= start | 16883 | if (!row->reversed_p) |
| 16876 | && glyph->type == CHAR_GLYPH | 16884 | { |
| 16877 | && INTEGERP (glyph->object)) | 16885 | while (glyph >= start |
| 16878 | --glyph; | 16886 | && glyph->type == CHAR_GLYPH |
| 16887 | && INTEGERP (glyph->object)) | ||
| 16888 | --glyph; | ||
| 16889 | } | ||
| 16890 | else | ||
| 16891 | { | ||
| 16892 | while (glyph <= start | ||
| 16893 | && glyph->type == CHAR_GLYPH | ||
| 16894 | && INTEGERP (glyph->object)) | ||
| 16895 | ++glyph; | ||
| 16896 | } | ||
| 16879 | 16897 | ||
| 16880 | /* If last glyph is a space or stretch, and it's trailing | 16898 | /* If last glyph is a space or stretch, and it's trailing |
| 16881 | whitespace, set the face of all trailing whitespace glyphs in | 16899 | whitespace, set the face of all trailing whitespace glyphs in |
| 16882 | IT->glyph_row to `trailing-whitespace'. */ | 16900 | IT->glyph_row to `trailing-whitespace'. */ |
| 16883 | if (glyph >= start | 16901 | if ((row->reversed_p ? glyph <= start : glyph >= start) |
| 16884 | && BUFFERP (glyph->object) | 16902 | && BUFFERP (glyph->object) |
| 16885 | && (glyph->type == STRETCH_GLYPH | 16903 | && (glyph->type == STRETCH_GLYPH |
| 16886 | || (glyph->type == CHAR_GLYPH | 16904 | || (glyph->type == CHAR_GLYPH |
| @@ -16891,12 +16909,24 @@ highlight_trailing_whitespace (f, row) | |||
| 16891 | if (face_id < 0) | 16909 | if (face_id < 0) |
| 16892 | return; | 16910 | return; |
| 16893 | 16911 | ||
| 16894 | while (glyph >= start | 16912 | if (!row->reversed_p) |
| 16895 | && BUFFERP (glyph->object) | 16913 | { |
| 16896 | && (glyph->type == STRETCH_GLYPH | 16914 | while (glyph >= start |
| 16897 | || (glyph->type == CHAR_GLYPH | 16915 | && BUFFERP (glyph->object) |
| 16898 | && glyph->u.ch == ' '))) | 16916 | && (glyph->type == STRETCH_GLYPH |
| 16899 | (glyph--)->face_id = face_id; | 16917 | || (glyph->type == CHAR_GLYPH |
| 16918 | && glyph->u.ch == ' '))) | ||
| 16919 | (glyph--)->face_id = face_id; | ||
| 16920 | } | ||
| 16921 | else | ||
| 16922 | { | ||
| 16923 | while (glyph <= start | ||
| 16924 | && BUFFERP (glyph->object) | ||
| 16925 | && (glyph->type == STRETCH_GLYPH | ||
| 16926 | || (glyph->type == CHAR_GLYPH | ||
| 16927 | && glyph->u.ch == ' '))) | ||
| 16928 | (glyph++)->face_id = face_id; | ||
| 16929 | } | ||
| 16900 | } | 16930 | } |
| 16901 | } | 16931 | } |
| 16902 | } | 16932 | } |