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.
This commit is contained in:
Eli Zaretskii 2020-11-14 13:43:16 +02:00
parent b697bb91a1
commit daff3bda10
2 changed files with 15 additions and 10 deletions

View file

@ -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);
}

View file

@ -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)