emacs-31 b365ef37b9b: Fix pixels-vs-columns confusion in margin face fill (bug#81109)
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit b365ef37b9b4b6810a1b13f0f8aebe7908e00b63 Author: Andrea Alberti <[email protected]> Commit: Eli Zaretskii <[email protected]> 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. --- src/xdisp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 2f02d9faa76..a88f7ce830a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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];