Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#2632 Selection-start changed by Pg-Up with Line numbers on


When editing a large file (1000+ lines) with Line numbers on, the point where the line numbers get an extra digit 999 - 1000) seems to have a bad effect on text selection. The start index of the selection changes spontaneously when using Page Up button.

1) Make sure option 'Display line number margin' is enabled:
* menu 'Settings' -> 'Preferences...', tab 'Editing', check the checkbox 'Display line number margin'.
2) Create a new blank text file.
3) Enter the text 'TEST TEXT' on line 1.
4) Copy this line so you end up with a file of 1100 lines, of which the last one is empty:


(You can also use the example file that I attached)

5) Place the cursor at the start of line 1098 (so column 1 of that line)
6) Use key Page Up while holding SHIFT to increase your selection towards the top. Press it repeatedly, keeping a close eye on the selection start index (the place where the selection begins)
7) Observe: Right around the point where the number of digits in the line numbering margin decreases from 4 to 3 (line number goes from 1000 to 999) the start of the selection is suddenly changed to column 2! The first character of the line is no longer selected!

This behaviour seems to be directly related to the line numbering. If line numbering is off, it disappears.



  • Stijn de Witt
    Stijn de Witt

    Ok, looking closer at this, I now suspect it's not the line number getting more digits that triggers this behaviour, but something related.

    Notepad++ treats the line number margin intelligently. If you are looking at the top of the file (say lines 1 -40), it reserves 3 digits for the line number in the margin. Scrolling down, the width of the margin stays the same up to the point where 999 is the last line that's on screen. But as soon as line 1000 becomes visible, Notepad++ has to increase the width of the margin with one extra digit so the line numbers for lines 1000 to 9999 will fit. Probably an extra character is also added again as soon as line 10000 first appears on screen, but I haven't tried this.

    The bug rears it's ugly head right at the point where Notepad++ needs to change the size of the margin. Where that is depends on whether you are scrolling up or down, and the size of your window.