Scroll screen not getting the cursor to bottom or top
-
Can I have the screen scrolled without the cursor getting the top or bottom line? If no more lines, i.e., first or end of file, are left, cursor can get to top or bottom. Normally before the cursor gets the bottom/top line of screen, the screen is scrolled. So I can preview 2~3 lines. Scroll window value is used for how many lines are shown. I can’t find any option related to this.
-
Yes. There are Scintilla commands to set this.
https://www.scintilla.org/ScintillaDoc.html#ScrollingAndAutomaticScrollingThis one is needed:
SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)
Though I am not sure how to make it auto-run in NPP directly.
I only know how to do it using the PythonScript plugin.
https://github.com/bruderstein/PythonScriptIf you have it installed, then open “startup.py” script and put these lines
somewhere in the bottom:editor.setEndAtLastLine(0) editor.setYCaretPolicy(13, 5) # set scroll offset to 5
Also set “Initialization: ATSTARTUP” in the plugin Configurarion menu.
This will set scroll offset to 5 lines (so change 5 in the second line to something else if needed).