Skip to content

Line numbers at larger numerical magnitudes shift screen during scrolling.  #2182

@caesar4

Description

@caesar4

Description of the Issue

Line numbers (when displayed) initially have a width of 3 digits (padded with spaces). When there are more than 999 lines of content, a subtle screen shift occurs to the right by 1 character when we scroll past line 1,000. Another jump occurs when we scroll past line 10,000, and so on.

This is a bit annoying if one works with a large data sets and have to scroll down occasionally through thousands of lines (equal-space fonts assumed). In other words, the position of any column X should be in the same horizontal location, relative to the computer screen, whether we scroll at the beginning of 150,000 lines of text, or in the middle, or near the end. The line-number field must be of constant width, adjusted to size of document, and also in the process of editing (say wring new line 1000).

Steps to Reproduce the Issue

  1. Enable line numbers.
  2. Copy/paste any text, preferably a fixed-width numbers, until slightly over 1,000 lines reached.
  3. Take a vertical scroll button and scroll down until line number 1000 is seen. Horizontal screen jump will occur, due to the variable width of line-number space.

Suggestion

After document is opened, the total number of lines is known (can also be seen on the status bar), which allows to create a line-number padding of width matching the largest width, thus creating scrolling without horizontal shifts.

WIDTH = floor( log( TOTAL_LINES )+1 ) // logarithm is base 10

Comment

This is the best notepad editor in existence across all present OS systems. Perfecting it is the reason in itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions