[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 ec172d748f 3/3: Avoid assertion violation due to fill-column in
From: |
Eli Zaretskii |
Subject: |
emacs-29 ec172d748f 3/3: Avoid assertion violation due to fill-column indicator face |
Date: |
Thu, 5 Jan 2023 15:34:40 -0500 (EST) |
branch: emacs-29
commit ec172d748f31121ed3d72e53e16fef5ee5f9018d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid assertion violation due to fill-column indicator face
* src/xdisp.c (extend_face_to_end_of_line): Use the original
iterator metrics for the stretch glyph, the one unaffected by the
'fill-column-indicator' face. (Bug#60580)
---
src/xdisp.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 6c88846e7a..d2c91e5847 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23322,8 +23322,9 @@ extend_face_to_end_of_line (struct it *it)
it->avoid_cursor_p = true;
it->object = Qnil;
- const int stretch_ascent = (((it->ascent + it->descent)
- * FONT_BASE (font)) / FONT_HEIGHT
(font));
+ const int stretch_height = it->ascent + it->descent;
+ const int stretch_ascent =
+ (stretch_height * FONT_BASE (font)) / FONT_HEIGHT (font);
if (indicator_column >= 0
&& indicator_column > it->current_x
@@ -23343,8 +23344,7 @@ extend_face_to_end_of_line (struct it *it)
if (stretch_width > 0)
{
append_stretch_glyph (it, Qnil, stretch_width,
- it->ascent + it->descent,
- stretch_ascent);
+ stretch_height, stretch_ascent);
}
/* Generate the glyph indicator only if
@@ -23352,6 +23352,8 @@ extend_face_to_end_of_line (struct it *it)
if (it->current_x < indicator_column)
{
const int save_face_id = it->face_id;
+ const int save_ascent = it->ascent;
+ const int save_descent = it->descent;
it->char_to_display
= XFIXNAT (Vdisplay_fill_column_indicator_character);
it->face_id
@@ -23359,6 +23361,8 @@ extend_face_to_end_of_line (struct it *it)
0, extend_face_id);
PRODUCE_GLYPHS (it);
it->face_id = save_face_id;
+ it->ascent = save_ascent;
+ it->descent = save_descent;
}
}
@@ -23372,8 +23376,7 @@ extend_face_to_end_of_line (struct it *it)
{
clear_position (it);
append_stretch_glyph (it, Qnil, stretch_width,
- it->ascent + it->descent,
- stretch_ascent);
+ stretch_height, stretch_ascent);
}
}