summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-11-14 13:43:16 +0200
committerEli Zaretskii <eliz@gnu.org>2020-11-14 13:43:16 +0200
commitdaff3bda10d15fe20f5f6e9c5f5ca60b97cf80df (patch)
treeb92ccb3b6a0f81560ef72773a189650326f33a63 /src
parentb697bb91a1334e70bd7c8364e5ff6505b0edb21a (diff)
downloademacs-daff3bda10d15fe20f5f6e9c5f5ca60b97cf80df.tar.gz
Avoid crashes when a reversed glyph row starts with a composition
* src/dispnew.c (build_frame_matrix_from_leaf_window): Add an assertion to prevent us from overwriting non-char glyphs with the vertical border glyph. * src/xdisp.c (extend_face_to_end_of_line): Account for one glyph possibly inserted by append_space_for_newline. (Bug#44506) Remove a kludgey correction for an off-by-one error in column counting, which is no longer needed.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c10
-rw-r--r--src/xdisp.c15
2 files changed, 15 insertions, 10 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index df55b32c718..7822829d648 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2559,11 +2559,15 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
the corresponding frame row to be updated. */
frame_row->enabled_p = true;
- /* Maybe insert a vertical border between horizontally adjacent
+ /* Maybe insert a vertical border between horizontally adjacent
windows. */
- if (GLYPH_CHAR (right_border_glyph) != 0)
+ if (GLYPH_CHAR (right_border_glyph) != 0)
{
- struct glyph *border = window_row->glyphs[LAST_AREA] - 1;
+ struct glyph *border = window_row->glyphs[LAST_AREA] - 1;
+ /* It's a subtle bug if we are overwriting some non-char
+ glyph with the vertical border glyph. */
+ eassert (border->type == CHAR_GLYPH);
+ border->type = CHAR_GLYPH;
SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph);
}
diff --git a/src/xdisp.c b/src/xdisp.c
index 71a5f1c34f0..681df093418 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -22074,13 +22074,14 @@ extend_face_to_end_of_line (struct it *it)
default_face->id : face->id);
/* Display fill-column indicator if needed. */
- /* We need to subtract 1 to the indicator_column here because we
- will add the indicator IN the column indicator number, not
- after it. We compare the variable it->current_x before
- producing the glyph. When FRAME_WINDOW_P we subtract
- CHAR_WIDTH calculating STRETCH_WIDTH for the same reason. */
- const int indicator_column =
- fill_column_indicator_column (it, 1) - 1;
+ const int indicator_column = fill_column_indicator_column (it, 1);
+
+ /* Make sure our idea of current_x is in sync with the glyphs
+ actually in the glyph row. They might differ because
+ append_space_for_newline can insert one glyph without
+ updating current_x. */
+ it->current_x = it->glyph_row->used[TEXT_AREA];
+
do
{
if (it->current_x != indicator_column)