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

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

bug#20022: 24.4.90; window-body-height, window-body-width wrong value af


From: Eli Zaretskii
Subject: bug#20022: 24.4.90; window-body-height, window-body-width wrong value after text-scale-adjust
Date: Sat, 07 Mar 2015 20:12:34 +0200

> From: Vitalie Spinu <spinuvit@gmail.com>
> Cc: 20022@debbugs.gnu.org
> Date: Sat, 07 Mar 2015 18:09:02 +0200
> 
>  >>> Eli Zaretskii on Sat, 07 Mar 2015 11:49:01 +0200 wrote:
> 
>  >> After text-scale-adjust [C-x C-] window-height and window-width return
>  >> the old (original) value.
> 
>  > As designed: the value is measured in canonical character units.
> 
> The doc string of of `window-body-width` and `window-body-height` don't
> even mention the measurement unit.

It says "divided by the character width".

> The docs can easel be more
> explicit. Something along the following lines:
> 
>   Return the height of WINDOW's text area in canonical lines. The height
>   of a canonical line is given by `frame-char-height`.

If there's agreement that mentioning canonical lines will make this
clear (personally, I'm not sure), I'm fine with that.  But adding the
sentence about frame-char-height IMO just muddies the water: having a
term that needs to be explained by telling how to compute it sends a
confusing message.

> BTW, the "width of a “default” character" is confusing as of the
> conflicting meaning with the `default-font-height`. "Canonical" is a
> better term IMO.

They are both vague, and need a lot of explanations to fully
understand.  Luckily, most people don't need to.

> I simply need the number of characters that can be fit in a single line
> in order to set the sub-process output width.

This can only be meaningfully computed if the text emitted by the
subprocess will be rendered in its entirety using the default face.
If that's what you need, it should be easy to provide such a function,
but I don't think we have it now.  Martin might have some tricks up
his sleeve, though.

> Building on your "approximation" trick, I can get an approximate width
> in pixels of the character, then divide the width of the window in
> pixels by this width to get the approximate number of characters. Is
> there an easier way?

Not that I know of.  We could provide a function for that, if this
functionality is deemed important enough.





reply via email to

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