How to programmatically determine if a bookmark is set for a given line number?
-
Is there a way to programmatically set or clear a bookmark? I don’t want to toggle the bookmark. I want to set it if it is not already set.
I have found these message types.
#define IDM_SEARCH_TOGGLE_BOOKMARK (IDM_SEARCH + 5) #define IDM_SEARCH_NEXT_BOOKMARK (IDM_SEARCH + 6) #define IDM_SEARCH_PREV_BOOKMARK (IDM_SEARCH + 7) #define IDM_SEARCH_CLEAR_BOOKMARKS (IDM_SEARCH + 8)
I want to check if a bookmark is set for the current line. If it is, then no additional action needed, if not set then I want to set it.
Is this possible?
Thank You!
Paul -
@Paul-Baker said in How to programmatically determine if a bookmark is set for a given line number?:
Is there a way to programmatically set or clear a bookmark?
Of course. :-)
“Markers” are a Scintilla function, so I’ll refer you to Scintilla docs for markers HERE.
N++ uses marker ID 20 for bookmarks.
You can search the N++ source code forMARK_BOOKMARK
to see some implementation. -
@Alan-Kilborn said in How to programmatically determine if a bookmark is set for a given line number?:
Of course. :-)
“Markers” are a Scintilla function, so I’ll refer you to Scintilla docs for markers HERE .
N++ uses marker ID 20 for bookmarks.
You can search the N++ source code for MARK_BOOKMARK to see some implementation.Thank you Alan. Everyone on this forum is so helpful. I’ll check out the doc and look for the implementations.
-Paul
-
The c# template I am using had these already defined… Not sure how I missed this. But thanks again!
/// <summary>Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043)</summary> int MarkerAdd(int line, int markerNumber); /// <summary>Delete a marker from a line. (Scintilla feature 2044)</summary> void MarkerDelete(int line, int markerNumber); /// <summary>Delete all markers with a particular number from all lines. (Scintilla feature 2045)</summary> void MarkerDeleteAll(int markerNumber); /// <summary>Get a bit mask of all the markers set on a line. (Scintilla feature 2046)</summary> int MarkerGet(int line);