Subject: Re: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup

From: martin rudalics <[email-masked]>
Date: Mon, 26 Jun 2017 10:21:15 +0200

> Btw, it strikes me that if we want something like that, it should be
 > much easier to provide side-by-side windows that scroll together or
 > according to some predefined relation.  This at least doesn't need to
 > redesign the basic display geometry of a window, only to change the
 > order in which we traverse the window tree -- instead of the current
 > depth-first order we'd need some more complicated traversal, and
 > perhaps also some redisplay considerations that look at more than one
 > window at a time.  Then just removing the scroll bars from all but one
 > of these "lockstep" windows will get you what you want at a much
 > smaller effort.

This is precisely what I had in mind and why I pleaded for a uniform
handling of windows elsewhere.  The question is whether and how to treat
margins, scroll bars and fringes as first class citizens in this regard.

Our scroll bars are already partly windows partly frames.  Hence
considering them a shared resource like the tool or menu bar
windows/frames should be straightforward.  Margins, fringes and line
numbers are subordinates but I would upgrade them so the display engine
is mostly disconnected from the layout problem.

Now I think we agree that two or more side-by-side windows emulating
‘follow-mode’ should share a single vertical scroll bar window whose
slider size and position would be computed from the amount of text
displayed in all of these windows taken together and the position of
‘point’ in the most recently selected window of them.

I think we could also have these windows share a common fringe and a
line number window.  I'm less sure about the margins.  I think a
vertical divider should be provided separately for each window so the
user can resize them separately with the mouse.  And a horizontal scroll
bar, if wanted, should be provided separately for each of the windows.

There's probably no rule for sharing mode and header lines: A common
mode line seems obviously preferable for ‘follow-mode’, a ruler in the
header line can be hardly shared.

An obvious problem ensuing from such an approach is, for example, that
the display engine may decide that the size of the line number window
must increase because one of the windows now has to display a larger
maximum line number or because ‘point’ has moved from a window with a
lower ‘point’ to a window with a higher one.  This will trigger a check
whether the remaining windows are still large enough and maybe how to
enlarge them.  So what is currently a local decision entirely embedded
in your line numbers code would become a more global decision of window
management.

martin