[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 daff3bd: Avoid crashes when a reversed glyph row starts with a
From: |
Eli Zaretskii |
Subject: |
emacs-27 daff3bd: Avoid crashes when a reversed glyph row starts with a composition |
Date: |
Sat, 14 Nov 2020 06:45:20 -0500 (EST) |
branch: emacs-27
commit daff3bda10d15fe20f5f6e9c5f5ca60b97cf80df
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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.
---
src/dispnew.c | 10 +++++++---
src/xdisp.c | 15 ++++++++-------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/dispnew.c b/src/dispnew.c
index df55b32..7822829 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 71a5f1c..681df09 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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 daff3bd: Avoid crashes when a reversed glyph row starts with a composition,
Eli Zaretskii <=