From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed Date: Fri, 13 May 2022 17:12:03 +0300 Message-ID: <83k0apmsi4.fsf@gnu.org> References: <87wneq7oeb.fsf@fastmail.fm> <87ee0xvblm.fsf@gnus.org> <83mtflmu5l.fsf@gnu.org> <87lev5tuqp.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28520"; mail-complaints-to="usenet@ciao.gmane.io" Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 13 16:14:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npW3b-0007Ir-14 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 16:14:15 +0200 Original-Received: from localhost ([::1]:47080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npW3a-0006cc-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 10:14:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npW2Q-0005hC-Ox for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 10:13:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npW2Q-0001Tq-BD for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 10:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npW2Q-0004M2-6B for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 10:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 May 2022 14:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55387 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 55387-submit@debbugs.gnu.org id=B55387.165245112516616 (code B ref 55387); Fri, 13 May 2022 14:13:02 +0000 Original-Received: (at 55387) by debbugs.gnu.org; 13 May 2022 14:12:05 +0000 Original-Received: from localhost ([127.0.0.1]:44433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npW1U-0004Jw-Pe for submit@debbugs.gnu.org; Fri, 13 May 2022 10:12:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npW1T-0004JJ-3G for 55387@debbugs.gnu.org; Fri, 13 May 2022 10:12:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33278) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npW1N-0001O9-PA; Fri, 13 May 2022 10:11:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=w3w2E1kQOCwDtr5mWQtUz5SOylr/9YedsJvx2/aIxMo=; b=AxX26+T9nCZq Xv4HzhbCpjiC5NbPiO5edNXEgnudSs3eymGax6wT9YIaxDMXPHPmnzu6GQ9Sm6VMyqQEL2/fZnFzh V5KYAFfD6qa/t62tV6kzKs9baux0qWvzoAaqokQjXsTNR0lw7mpwYMJTZ+W5+DW7w9fiDVKVym7ym jYpcqlViwt1MXFIHRDccUFLwcI+7l6K1XNjNnbSdBXx2SJGP/KctWkL3n8+ad0d7aAIPwpzxHzJ+g GdOL1eTF2FaMiYFngDP6Nu7lyf8cUotAG9rzD6QPU/LyIv4vqG+RPP1uxr9ejJ/PCADUTnq3vGGF7 8ZoSqa+ps+KOkNXUgHDTpw==; Original-Received: from [87.69.77.57] (port=1821 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npW1N-0001Nb-5C; Fri, 13 May 2022 10:11:57 -0400 In-Reply-To: <87lev5tuqp.fsf@gnus.org> (message from Lars Ingebrigtsen on Fri, 13 May 2022 15:41:50 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232153 Archived-At: > From: Lars Ingebrigtsen > Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org > Date: Fri, 13 May 2022 15:41:50 +0200 > > Eli Zaretskii writes: > > > I don't think I understand how this could work. The line-number width > > is not fixed, it changes dynamically as needed. How would the > > header-line adapt itself, except in some hook that is called by > > redisplay? > > header-line-format would look like > > (display-line-spaces ) > > where display-line-spaces would indeed be updated by the redisplay code > (to be of the same length as (line-number-display-width 'columns)). This last bit is what I don't understand. Redisplay code works one screen line at a time, and it does that from the highest line to the lowest line ("highest" and "lowest" don't necessarily mean the first and the last visible lines in a window, they could mean line number N and line number M, where N <= M). When (and if) it displays the header-line, it doesn't yet know that the lines showing text will need a wider line-number display; it will know that only when it works on the first screen line of text it was asked to display. And when it displays a screen line of text, it doesn't consider header-line-format, not even whether the window has a header-line. 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. 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?