64-bit Windows 7. Notepad 5.9.3. PythonScript 0.9.3.1.
I have a couple of scripts I use to scroll the current line to the top or bottom of the window. I just got this new system set up (new job) and those commands aren't working. On debugging, I see a case where, for instance, the first visible line is #493, the line with the cursor is #515, and editor.getFirstVisibleLine() is returning 516, which is breaking the script. (I'm not sure if the actual cursor line has anything to do with the return value.)
Here's the script:
line = editor.getFirstVisibleLine() + editor.linesOnScreen() - 1
end = editor.getLineEndPosition(line)
pos = editor.findColumn(line, editor.getColumn(editor.getCurrentPos()))
editor.gotoPos(min(pos, end))
if end < pos:
editor.lineEnd() # hack: gotoPos() doesn't change lineUp/lineDown target column
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
64-bit Windows 7. Notepad 5.9.3. PythonScript 0.9.3.1.
I have a couple of scripts I use to scroll the current line to the top or bottom of the window. I just got this new system set up (new job) and those commands aren't working. On debugging, I see a case where, for instance, the first visible line is #493, the line with the cursor is #515, and editor.getFirstVisibleLine() is returning 516, which is breaking the script. (I'm not sure if the actual cursor line has anything to do with the return value.)
Here's the script:
From the scintilla documentation (http://www.scintilla.org/ScintillaDoc.html#SCI_GETFIRSTVISIBLELINE) I'd guess this has something to do with line wrapping or hidden lines. Check if you've got line wrap on, and if you've got any folded sections.
I don't think it's a python issue, as the numbers get passed straight through from Scintilla…
You're quite right! Bother.