GNU bug report logs -
#34476
fluffy whitespace in the mode-line, despite it running off the screen
Previous Next
Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Date: Thu, 14 Feb 2019 13:53:01 UTC
Severity: wishlist
Tags: fixed
Found in version 5.13
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: contovob <at> tcd.ie, 34476 <at> debbugs.gnu.org, jidanni <at> jidanni.org
> Date: Fri, 07 Aug 2020 13:41:15 +0200
>
> > And it formats the mode-line twice: once in format-mode-line, then
> > again in display_string, right?
>
> No, display_string just displays the string, I think?
Which is a non-trivial amount of work: loading all the font glyphs
again and accounting for their metrics, considering the faces, etc.
All of which was already done.
> > You don't need all this inelegance. After display_mode_element
> > returns, you have all the glyphs it produced in it.glyph_row, so you
> > can simply remove the unneeded space glyphs from the glyph row (and
> > adjust the metrics accordingly). Let me know if you need more
> > detailed help in how to do that.
>
> That seems like a lot more work, I think?
Why a lot more work? It's basically the same loop as you do on
characters of the string produced by Fformat_mode_line, just done on
elements of it.glyph_row->glyphs[TEXT_AREA], which is a linear array
of 'struct glyph'. Each glyph tells you what character it displays
(and much more). There are gobs of similar code in xdisp.c. For
example, here's how we make space in a glyph row for prepending a
character (needed when displaying R2L lines):
struct glyph *g;
/* Make room for the additional glyph. */
for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--)
g[1] = *g;
glyph = it->glyph_row->glyphs[area];
IOW, it's just an array of simple objects, not unlike array of
characters, a.k.a. "a string".
If this still sounds complicated, I can volunteer to write the code
myself, if you promise to write tests for the feature ;-)
Thanks.
This bug report was last modified 4 years and 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.