[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38717: display-line-numbers set to relative

From: Stefan Kangas
Subject: bug#38717: display-line-numbers set to relative
Date: Wed, 15 Jan 2020 20:50:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> tags 38717 notabug
> thanks
>> From: "Franco A. Cortesi" <address@hidden>
>> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]