Skip to content

improve: [line-numbers-mode] - Sync line format with lines that are displayed #1726

@Encryptoid

Description

@Encryptoid

Description

When using a lower number format than the default(6), each line only displays the length that matches that line, as shown in the image:

image

It would be good to match most other editors by having the actual format sync with the lines that are being displayed, so all lines-numbers have the same width. This means when showing 2 digit lines, and you scroll down to a 3 digit line, the 2 digit lines will expand their width to match the 3 digits.

I imagine this is why a high default of 6 was chosen, but it produces a very large block like this:
image
It would be good to reduce the default after fixing.

Steps to reproduce

Set a lower format like this: (or open a file with 1M+ lines!)

(setf (lem:variable-value 'lem/line-numbers:line-number-format :global) "~1D ")

Recommendations

I am not sure if Lem has a concept yet of which lines are currently being displayed, but this might be a lot easier after that.

It also might not be directly in the handling of the string format, but I think you can also pass a function to work out the line number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions