#2192 Width of line number margin changes when scrolling


I noticed that the width of line number margin is always equal to 3 characters initially no matter how many lines the loaded file has. Which is fine if there are fewer than 999 lines, but if there are more and you scroll past line 999, the width of the line number margin increases (to accommodate one more number) and the whole text shifts sligthly to the right as a result. The opposite happens if you scroll back up to the top of the file - the line number margin becomes 3 characters wide again and the text/code you are looking at shifts left again, which is slightly distracting.

Also, when you have fewer than 99 lines of code, the line number margin is 1 character too wide. I think it would be nice if the editor automatically adjusted the width of line number margin when the file is loaded depending on how many lines the file has. If <99 lines then make it 2 characters wide, if <999 lines - then 3 chars wide and so on. This would eliminate dynamic adjustment during scrolling and jerking the text to the right or left.


  • cchris

    It wouldn't help. Load a 97 line text file, and add a few lines -> margin should grow. Now remove about as many lines elsewhere: suddenly the margin would shrink. This alternate behaviour would be just as distracting.

  • cchris, I agree with your argument, and I also recognize that this is not such a big deal after all. This is just something I noticed and decided to report. However, I still think that it makes sense to set the width of the line number margin to accommodate the largest line number in a given file at the moment the file is loaded. And then if new lines are added the width can be grown as necessary. And it's not even certain that it will need to grow. While it's quite certain that the width will be changing during scrolling if it does not fit the largest line number.

    Also, why to set it to 3? Why not 2? Why not 4?

    Again, these are just my thoughts, I am not in a position to dictate anything. For all I know, this behavior could be coming from Scintilla component and not from Notepad++ per se...

  • Hoover

    Is there any way to manually configure this width? I would like to just set it to 4 all the time...I write a lot of bigger PHP files and I'd rather have a 10 line PHP that is 4 lines wide than having the odd jump back and forth...after staring at code 1/2 the day it's a little disorienting when scrolling between line 970 and 1100 over and over

  • zorekryk

    I agree with mikehoover. If it's difficult to autodetect the number of lines in the file and set the line number margin width accordingly, it would be desirable to be able to set it manually. 4 would work for me too.

  • I have an problem with the line number margin - it shows maximal 4 digits-
    thats not enough if your file have 42825 lines. :-)
    an option for this would be great.

    Leuchtende Grüße