I am trying to write a script that will bookmark lines that contain certain text. So far I have:
editor.markerDeleteAll(0)
def bookmarks(lineText, lineNumber, totalLines):
patterns = ['>','<','[',']','SESSION']
for p in patterns:
if lineText.find(p) > -1:
editor.markerAdd(lineNumber, 0)
return 1
editor.forEachLine(bookmarks)
This successfully finds the text being searched for, but neither deletes existing bookmarks (those added in the normal way by pressing F2) nor adds new ones. What am I misunderstanding?
Last edit: ChildeAgrestis 2014-11-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's the marker number. If you mark a line, then use markerGet (at least i
think that's what its called, sadly scintilla naming is not consistent) on
that line, you can find the marker number. From memory, that gives you the
integer representation, but you provide the bit number to markerAdd - so
bit 0 is 1, bit 1 is 2, bit 2 is 4, 3 is 8 and so on.
I have a feeling notepad++ uses marker 19 for the bookmarks, but that's
more or less a guess!
I am trying to write a script that will bookmark lines that contain certain text. So far I have:
This successfully finds the text being searched for, but neither deletes existing bookmarks (those added in the normal way by pressing F2) nor adds new ones. What am I misunderstanding?
Last edit: ChildeAgrestis 2014-11-22
It's the marker number. If you mark a line, then use markerGet (at least i
think that's what its called, sadly scintilla naming is not consistent) on
that line, you can find the marker number. From memory, that gives you the
integer representation, but you provide the bit number to markerAdd - so
bit 0 is 1, bit 1 is 2, bit 2 is 4, 3 is 8 and so on.
I have a feeling notepad++ uses marker 19 for the bookmarks, but that's
more or less a guess!
Hope that helps.
Dave
Many thanks! And it turns out the standard notepad++ bookmark marker number is 24.