Can you try this:
HashMap<int> bookmarks = new HashMap<int>();
for (int i = 0; i < scintilla1.Lines.Count; i++)
{
bookmarks.Add(scintilla1.Markers.FindNextMarker(i).Number);
}
foreach (var bookmark in bookmarks)
{
MessageBox.Show(bookmark.ToString());
}
Also, it should be noted that FindNextMarker
will return the next line that has a marker (see implementation here). So I think you approach is wrong. It should probably be more like this:
HashMap<int> bookmarks = new HashMap<int>();
int nextBookmark = 0;
while (nextBookmark != UInt32.MaxValue)
{
nextBookmark = scintilla1.Markers.FindNextMarker(nextBookmark).Line;
if (nextBookmark != UInt32.MaxValue)
{
bookmarks.Add(nextBookmark);
}
}
foreach (var bookmark in bookmarks)
{
MessageBox.Show(bookmark.ToString());
}
Better yet, you can get ALL the markers using public List<Marker> GetMarkers(int line)
:
foreach (var bookmark in scintilla1.Markers.GetMarkers(0))
{
MessageBox.Show(bookmark.Line.ToString());
}
To be noted, there appears to be a maximum of 32 markers per file. See the markers documentation on the Scintilla site.