From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#38717: display-line-numbers set to relative Date: Mon, 23 Dec 2019 15:47:53 +0200 Message-ID: <83h81rxieu.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="157594"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38717@debbugs.gnu.org To: "Franco A. Cortesi" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 23 14:49:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ijO5C-000ep7-3r for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Dec 2019 14:49:14 +0100 Original-Received: from localhost ([::1]:57160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijO5A-0006Eu-13 for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Dec 2019 08:49:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58184) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijO52-0006E3-FV for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2019 08:49:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ijO51-0000kp-7s for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2019 08:49:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ijO50-0000kF-EO for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2019 08:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ijO50-0006RP-E1 for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2019 08:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Dec 2019 13:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38717 X-GNU-PR-Package: emacs Original-Received: via spool by 38717-submit@debbugs.gnu.org id=B38717.157710889924682 (code B ref 38717); Mon, 23 Dec 2019 13:49:02 +0000 Original-Received: (at 38717) by debbugs.gnu.org; 23 Dec 2019 13:48:19 +0000 Original-Received: from localhost ([127.0.0.1]:50650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ijO4I-0006Px-O9 for submit@debbugs.gnu.org; Mon, 23 Dec 2019 08:48:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ijO4G-0006Pb-9p; Mon, 23 Dec 2019 08:48:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ijO4A-0008Vj-Ip; Mon, 23 Dec 2019 08:48:10 -0500 Original-Received: from [176.228.60.248] (port=1632 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ijO4A-0001Dm-14; Mon, 23 Dec 2019 08:48:10 -0500 In-reply-to: (cortesifranco3@gmail.com) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173669 Archived-At: tags 38717 notabug thanks > From: "Franco A. Cortesi" > Date: Mon, 23 Dec 2019 00:49:47 -0300 > > When display-line-numbers is set to 'relative', the number of spaces before the digits starts growing (to two) > when the current line hits 43 in my case. Of course, no other line has more than two digits as the screen only > has 56 lines in total so the growing of spaces (and columns) is not needed at all and of course is undesired. > This behavior seems to be correctly implemented but for absolute line numbers, where hitting line 43 means > the bottom line is close to start showing numbers with three digits. This is a side effect of the implementation, which avoids scanning the entire area to be displayed twice, and instead estimates the maximum width of a line number when the first line of a window is displayed, and then sticks to that width for that window. Since Emacs can display variable-size fonts in the same window-full, it must be pessimistic and assume the smallest possible font (which makes the last line's number become larger, and cross the 3-digits threshold sooner). I don't think this is too much to pay for lightning-fast display of line numbers (unlike linum.el and similar modes). > The current line always showing the absolute line number is another big problem as it will make the number > of columns to grow and srink anyway. This growing and shrinking could be totally prevented if users were able > to remove or configure the contents of the current line indicator. If configurable, a custom face would be also > very good. For example a colored "-" indicating the current line would be nice for many users. Sounds like you want to customize the option display-line-numbers-current-absolute, and maybe also to customize the line-number-current-face face. In general, I suggest to type M-x customize-group RET display-line-numbers RET and review the customizable options this mode offers, you might find something you want to change from the default. (The most important options are also described in the Emacs manual.) > Lastly and less important, it would be great to be able to remove the space before the first numeric character! Cannot be done easily, because Emacs supports right-to-left text, where line numbers appear on the right, and when the line number is rendered, Emacs doesn't yet know whether the text after the line number is R2L or L2R.