This patch fixes bug #4293
All text changes (and all caret position changes) will remember the caret's new horizontal position when moving to different lines. However, the horizontal position is not measured in characters but in pixels from the left side of the window.
Between the left side of the window and the text pane there is the margin pane (i.e. line number margin, bookmark margin and folding margin).
When the size of the margin pane is changed, then the horizontal position of the text changes but not the remembered caret's horizontal position relative to the window. Thus moving then the caret to a different line will result in a jump in column position.
Such jumps in column positions from line to line could be observed after e.g.:
- enable or disable the bookmark margin
- ZoomIn or ZoomOut (ctrl-num + or ctrl-num -), which changes the size of the characters
- always for TrueType fonts with non equidistant characters
- and finally changing the size of the line number margin
This behaviour is part of Scintilla windows control library, which is used by Notepad++. It can be observed also in SciTE, the Scintilla own editor, which has the same issue when enable/disable its "fold margin".
Reason of bug:
Notepad++ sets the line number margin to 3 digits by default and adapts the line number margin when the window is scrolled to 4 digit line numbers. When jumping back to the first line, the line number margin is reduced after the jump is performed. Therefore, the remembered horizontal position from the left window size is not updated correctly.
A work around is to press two times ctrl-home!
I have generated a patch, which sets the line number margin width to the digit number of the maximum lines in the file and does not adapt the line number margin when moving through the file.
Furthermore, some dead code is commented, which is to be deleted lateron.
Patch: NppPatch_6.3.2_NoLineNumberMarginSizeUpdate.patch against SVN-revision 1037