Subject: bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 13 May 2022 17:52:11 +0200

Eli Zaretskii <[email-masked]> writes:

> Moreover, the code which produces the line-numbers can be called when
> the line doesn't need to be displayed at all, only its metrics
> measured, for some job related to layout of text.  In this case, it
> would be unthinkable to modify the header-line as a side effect,
> because no one expects the header-line to be updated on display when,
> say, the user presses C-n in the middle of a window.
>
> So again, I don't understand how this can work.

I don't really understand your point here, so I'm probably
misunderstanding something fundamental.  My thought was just that the
thing that produces the line number would set a
line-number-width/columns variable.  When redisplay formats the header
line (whenever it wants to do that), that variable would be set, so it
would just render it in the totally normal way.

> This is why we have hooks that redisplay calls in strategic places,
> and tabulated-list.el uses them to update the header-line.  Why isn't
> that a better way?

Because this affects all modes that have a columnar layout and uses a
header line.

> Btw, isn't it true that the problem is not in displaying the
> header-line, but in adjusting the alignment of the _body_ of the table
> to the changes in header-line (which happen automatically)?  In which
> case how will header-line construct help?

The header line isn't adjusted automatically by display-line-number-mode.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no