Fix pixels-vs-columns confusion in margin face fill (bug#81109)

* src/xdisp.c (extend_face_to_end_of_line): WINDOW_LEFT/RIGHT_MARGIN_WIDTH
is a pixel value (columns times the frame column width).  Compare the
margin glyph count against WINDOW_LEFT/RIGHT_MARGIN_COLS instead, and use
the *_WIDTH value directly for remaining_pixels rather than multiplying it
by FRAME_COLUMN_WIDTH a second time.  The old code worked on text
terminals, where the column width is one pixel, but computed wrong widths
on GUI frames.
This commit is contained in:
Andrea Alberti 2026-06-25 12:05:03 +02:00 committed by Eli Zaretskii
parent e0185b0907
commit b365ef37b9

View file

@ -24463,11 +24463,10 @@ extend_face_to_end_of_line (struct it *it)
to fill the rest. */
if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0
&& (it->glyph_row->used[LEFT_MARGIN_AREA]
< WINDOW_LEFT_MARGIN_WIDTH (it->w)))
< WINDOW_LEFT_MARGIN_COLS (it->w)))
{
int used = it->glyph_row->used[LEFT_MARGIN_AREA];
int remaining_pixels = (WINDOW_LEFT_MARGIN_WIDTH (it->w)
* FRAME_COLUMN_WIDTH (f));
int remaining_pixels = WINDOW_LEFT_MARGIN_WIDTH (it->w);
/* Subtract width of existing glyphs. */
struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA];
@ -24502,11 +24501,10 @@ extend_face_to_end_of_line (struct it *it)
to fill the rest. */
if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0
&& (it->glyph_row->used[RIGHT_MARGIN_AREA]
< WINDOW_RIGHT_MARGIN_WIDTH (it->w)))
< WINDOW_RIGHT_MARGIN_COLS (it->w)))
{
int used = it->glyph_row->used[RIGHT_MARGIN_AREA];
int remaining_pixels = (WINDOW_RIGHT_MARGIN_WIDTH (it->w)
* FRAME_COLUMN_WIDTH (f));
int remaining_pixels = WINDOW_RIGHT_MARGIN_WIDTH (it->w);
/* Subtract width of existing glyphs. */
struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA];