summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-11-17 11:21:01 +0200
committerEli Zaretskii <eliz@gnu.org>2022-11-17 11:21:01 +0200
commit667857211072a0d80192e49cf9788ccdbfa856c5 (patch)
treefc8f40a237d0a417a33a78cfef59d31950cf4fdc /src
parent61b9f2c3179aa454963493e1923307e875e2322a (diff)
downloademacs-667857211072a0d80192e49cf9788ccdbfa856c5.tar.gz
Fix display of mode line when the right divider is used
* src/xdisp.c (init_iterator): For the mode-line, adjust last_visible_x due to the right divider and the 'box' attribute, if any, of the mode-line face. (display_min_width): Update current_x after producing the stretch glyph, to mimic PRODUCE_GLYPHS. (display_mode_line): Widen the last glyph to account for adding the right box line to it. (Bug#5930)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index f6a279636a0..3b4f0b39569 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3342,7 +3342,8 @@ init_iterator (struct it *it, struct window *w,
{
/* Mode lines, menu bar in terminal frames. */
it->first_visible_x = 0;
- it->last_visible_x = body_width = WINDOW_PIXEL_WIDTH (w);
+ it->last_visible_x =
+ WINDOW_PIXEL_WIDTH (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w);
}
else
{
@@ -3410,8 +3411,13 @@ init_iterator (struct it *it, struct window *w,
face = FACE_FROM_ID_OR_NULL (it->f, remapped_base_face_id);
if (face && face->box != FACE_NO_BOX)
{
+ int box_thickness = face->box_vertical_line_width;
it->face_box_p = true;
it->start_of_box_run_p = true;
+ /* Make sure we will have enough horizontal space to add the
+ right box line at the end. */
+ if (box_thickness > 0)
+ it->last_visible_x -= box_thickness;
}
}
@@ -5324,6 +5330,8 @@ display_min_width (struct it *it, ptrdiff_t bufpos,
/* Insert the stretch glyph. */
it->object = list3 (Qspace, QCwidth, w);
produce_stretch_glyph (it);
+ if (it->area == TEXT_AREA)
+ it->current_x += it->pixel_width;
it->min_width_property = Qnil;
}
}
@@ -26718,7 +26726,17 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
{
struct glyph *last = (it.glyph_row->glyphs[TEXT_AREA]
+ it.glyph_row->used[TEXT_AREA] - 1);
+ int box_thickness = face->box_vertical_line_width;
last->right_box_line_p = true;
+ /* Add back the space for the right box line we subtracted in
+ init_iterator, since the right_box_line_p flag will make the
+ glyph wider. We actually add only as much space as is
+ available for the last glyph of the modeline and whatever
+ space is left beyond it, since that glyph could be only
+ partially visible */
+ if (box_thickness > 0)
+ last->pixel_width += max (0, (box_thickness
+ - (it.current_x - it.last_visible_x)));
}
return it.glyph_row->height;