emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6678572110: Fix display of mode line when the right divider is us


From: Eli Zaretskii
Subject: master 6678572110: Fix display of mode line when the right divider is used
Date: Thu, 17 Nov 2022 04:23:25 -0500 (EST)

branch: master
commit 667857211072a0d80192e49cf9788ccdbfa856c5
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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)
---
 src/xdisp.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index f6a279636a..3b4f0b3956 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]