aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2010-03-31 17:28:16 +0300
committerEli Zaretskii <[email protected]>2010-03-31 17:28:16 +0300
commit52c3078336b724f3d657e2405136f66524483ecb (patch)
tree85311157792d2bf1973a1a1436f0a698984746a2 /src
parentd35ad51f14527024845454830ae458bd7e6fe7dd (diff)
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/ChangeLog5
-rw-r--r--src/xdisp.c52
2 files changed, 46 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9d70a3327b..3c43c80764 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-31 Eli Zaretskii <[email protected]>
+
+ * xdisp.c (highlight_trailing_whitespace): Support highlight of
+ trailing whitespace in right-to-left rows.
+
2010-03-31 Stefan Monnier <[email protected]>
Get rid of the direct_output optimizations.
diff --git a/src/xdisp.c b/src/xdisp.c
index b3aaa52e2e..709ff5f6d6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16868,19 +16868,37 @@ highlight_trailing_whitespace (f, row)
struct glyph *start = row->glyphs[TEXT_AREA];
struct glyph *glyph = start + used - 1;
+ if (row->reversed_p)
+ {
+ /* Right-to-left rows need to be processed in the opposite
+ direction, so swap the edge pointers. */
+ glyph = start;
+ start = row->glyphs[TEXT_AREA] + used - 1;
+ }
+
/* Skip over glyphs inserted to display the cursor at the
end of a line, for extending the face of the last glyph
to the end of the line on terminals, and for truncation
and continuation glyphs. */
- while (glyph >= start
- && glyph->type == CHAR_GLYPH
- && INTEGERP (glyph->object))
- --glyph;
+ if (!row->reversed_p)
+ {
+ while (glyph >= start
+ && glyph->type == CHAR_GLYPH
+ && INTEGERP (glyph->object))
+ --glyph;
+ }
+ else
+ {
+ while (glyph <= start
+ && glyph->type == CHAR_GLYPH
+ && INTEGERP (glyph->object))
+ ++glyph;
+ }
/* If last glyph is a space or stretch, and it's trailing
whitespace, set the face of all trailing whitespace glyphs in
IT->glyph_row to `trailing-whitespace'. */
- if (glyph >= start
+ if ((row->reversed_p ? glyph <= start : glyph >= start)
&& BUFFERP (glyph->object)
&& (glyph->type == STRETCH_GLYPH
|| (glyph->type == CHAR_GLYPH
@@ -16891,12 +16909,24 @@ highlight_trailing_whitespace (f, row)
if (face_id < 0)
return;
- while (glyph >= start
- && BUFFERP (glyph->object)
- && (glyph->type == STRETCH_GLYPH
- || (glyph->type == CHAR_GLYPH
- && glyph->u.ch == ' ')))
- (glyph--)->face_id = face_id;
+ if (!row->reversed_p)
+ {
+ while (glyph >= start
+ && BUFFERP (glyph->object)
+ && (glyph->type == STRETCH_GLYPH
+ || (glyph->type == CHAR_GLYPH
+ && glyph->u.ch == ' ')))
+ (glyph--)->face_id = face_id;
+ }
+ else
+ {
+ while (glyph <= start
+ && BUFFERP (glyph->object)
+ && (glyph->type == STRETCH_GLYPH
+ || (glyph->type == CHAR_GLYPH
+ && glyph->u.ch == ' ')))
+ (glyph++)->face_id = face_id;
+ }
}
}
}