[Top][All Lists]

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

Re: [PATCH] Add function window-line-width

From: Sébastien Chapuis
Subject: Re: [PATCH] Add function window-line-width
Date: Fri, 8 Nov 2019 12:54:30 +0800

Ah, I didn't know about 'window-lines-pixel-dimensions'.
I knew 'window-line-height' and thought there was no equivalent for the width.

However 'window-lines-pixel-dimensions' has differences with the implementation I proposed:
- It counts the glyphs 'inserted by redisplay for its own purposes' [1].
  On a line with no characters, the function often return a width > 0 (1 or 2 characters, in my tests).
  Similarly, on a line with characters it returns more pixels than there really is.
- It allocates a cons and 2 integer for each line.
  In my use case, I have to get the width of _all_ the lines on the current window every time the cursor is
  changing line or when a character is inserted/removed in the buffer. So it occurs quite often.
  But that's micro optimization and I am not sure if there is a big impact.
- We can't choose the area in the window (left_margin_area, text_area or right_margin_area),
  but I don't need this for my use case, so it's not important to me.

The first point is important for my use case, so if 'window-line-width' is not accepted, would you agree for a patch
adding a parameter to 'window-lines-pixel-dimensions' controlling this behavior ?

'window-text-pixel-size' uses a display iterator to compute values, I don't know the details of this iterator but it seems to
be slower than fetching values directly from the glyph matrix. As mentioned, I need the width of all lines on window.

[1] https://github.com/emacs-mirror/emacs/blob/a070bd1c8b5213ad469d41dd80d392f924644aed/src/dispextern.h#L426-L428

Sebastien Chapuis.

Le jeu. 7 nov. 2019 à 16:50, martin rudalics <address@hidden> a écrit :
And I obviously forgot to mention 'window-lines-pixel-dimensions' and


reply via email to

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