From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#38717: display-line-numbers set to relative Date: Wed, 15 Jan 2020 20:50:26 +0100 Message-ID: <87k15s1ou5.fsf@marxist.se> References: <83h81rxieu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="40444"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 38717-done@debbugs.gnu.org, "Franco A. Cortesi" To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 15 20:51:19 2020 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 1irohD-000ADg-BT for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Jan 2020 20:51:19 +0100 Original-Received: from localhost ([::1]:59928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irohB-0007Ri-UK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Jan 2020 14:51:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40261) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irogz-0007PF-B6 for bug-gnu-emacs@gnu.org; Wed, 15 Jan 2020 14:51:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irogx-00055H-7A for bug-gnu-emacs@gnu.org; Wed, 15 Jan 2020 14:51:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57863) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1irogx-000551-3f for bug-gnu-emacs@gnu.org; Wed, 15 Jan 2020 14:51:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1irogx-0008Tj-3N for bug-gnu-emacs@gnu.org; Wed, 15 Jan 2020 14:51:03 -0500 Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Jan 2020 19:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 38717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 38717@debbugs.gnu.org, stefan@marxist.se, cortesifranco3@gmail.com Original-Received: via spool by 38717-done@debbugs.gnu.org id=D38717.157911784332550 (code D ref 38717); Wed, 15 Jan 2020 19:51:02 +0000 Original-Received: (at 38717-done) by debbugs.gnu.org; 15 Jan 2020 19:50:43 +0000 Original-Received: from localhost ([127.0.0.1]:35601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irogZ-0008Ss-SW for submit@debbugs.gnu.org; Wed, 15 Jan 2020 14:50:43 -0500 Original-Received: from ted.gofardesign.uk ([67.225.143.91]:39600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irogT-0008SR-NU for 38717-done@debbugs.gnu.org; Wed, 15 Jan 2020 14:50:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7+rdLReZXgtppkG49k67nknn/Qi4fbr/vAELccUpuBs=; b=rnqrLJUfpfrWFjIxTd3SEfWjBx dQcq5CLDM9M1RXdgwYUoKP4hUIvR/vRCltQVVhrhv5SvQ30vIf+e7rANA2L1NccOKavZvldAnZi+Z xrTh/918V0MtgdyAmBdvM2hU2MdDwGBHRO2/cvw1nknHFmKw4pmRcEArOejBJMKIFIA6lz+fdwL03 QyKtkNybcESmvyYw4VkIwQDTaJePrgDuqByjRPEO6mvtcICzX9Z76I5frRqXhl15KEHpc0DdRrI8t MwU54Pt/2Rd2d3gGJhWywFaHFEudrxaBOAONKlcwOBXxMNwGPfKCpHlIyFyGttSiDZmZQbFHOQdm+ ns7OlIDg==; Original-Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:56408 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1irogO-001qhY-3t; Wed, 15 Jan 2020 14:50:28 -0500 In-Reply-To: <83h81rxieu.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 23 Dec 2019 15:47:53 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:174657 Archived-At: Eli Zaretskii writes: > 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. So it seems like there is nothing to do here and I'm closing this bug. Best regards, Stefan Kangas