[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to record the line number pixel width for each window.
From: |
Eli Zaretskii |
Subject: |
Re: How to record the line number pixel width for each window. |
Date: |
Sat, 07 Dec 2019 10:27:14 +0200 |
> Cc: "address@hidden" <address@hidden>
> From: Keith David Bershatsky <address@hidden>
> Date: Fri, 6 Dec 2019 11:29:04 -0800
>
> By "simulate", I had in mind actively using the move_it family of functions
> -- where Emacs inhibits updating the glass and we can navigate the text to
> ascertain and/ or set certain values. For example, the sample snippet/diff
> in the opening post of this thread occurs when Emacs is using IT to set the
> value of the line number pixel width, and this is happening in the context of
> what I think of as a redisplay simulation. The solution to my issue may be
> as simple as devising a condition limiting just when to set the window object
> with the line number pixel width; e.g., when IT is on the first visible line
> of text in the window (following the header line, if any). Right now, the
> snippet sets the value when IT is on other lines besides the first line of
> text in the window, perhaps even a hidden / invisible line due to folded
> text. Perhaps that folded / invisible line would have a different line
> number pixel width, but it is not used because it is hidden and the value is
> erroneous.
I don't have any specific advice for you. In general, the required
width of the line-number display is calculated when a window's
redisplay starts, the first time display_line is called for that
window's text area. In some rare cases, displaying subsequent lines
comes up with a larger value (as can be seen in Org mode with many
folded line). So maybe looking at the last value in a window will do
what you want.
Again, I don't recommend this approach, as it is fundamentally wrong
IMO.