bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31020: 27.0; Please provide a way to know about menu-bar wrapping


From: Drew Adams
Subject: bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
Date: Tue, 3 Apr 2018 07:28:32 -0700 (PDT)

>  > The problem, at least on MS Windows, is that the
>  > menu-bar wraps, and there is no way (AFAIK) to know
>  > from Lisp who many actual lines are currently used
>  > to show the menu-bar.
>  >
>  > This is an old problem, as you know.  It would be
>  > really good to finally put it to bed, if possible.
> 
> Can you tell me one practical case where you want to
> know how many lines are used to show the menu bar?

Yes.  But you'll perhaps tell me to do things another
way (e.g., pixelwise). ;-)

My fit-frame.el code changes a frame's width and height
to fit the buffer text.  It also takes into account
things like `menu-bar-lines' and `tool-bar-lines'.  It
does its work using chars, i.e., lines and columns, not
pixels.

If the frame before fitting is narrow enough that the
menu-bar is wrapped, and if the frame is narrower than
its fit width (the width it will be fit to, based on
max line length), then the resulting height is slightly
greater than when the menu-bar is not wrapped.  (The
latter height is what I want.)

This has the effect that two different resulting frame
heights are possible, depending on whether the menu is
wrapped.  So the action is not idempotent if the bar is
wrapped (and the max line length is wider than the
unwrapped menu-bar width): The first `fit-frame' makes
the frame a bit taller; the second and subsequent calls
to `fit-frame' make it the right height.  (All calls
give it the right width.)

If my code could know how many _effective_ (i.e.,
visual) `menu-bar-lines' were currently present then
it would just DTRT.

HTH.





reply via email to

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