Book marks

Topics: Developer Forum, User Forum
Feb 5, 2013 at 8:32 PM
How do you use bookmarks and navigate through them and not get lost in index ?!

this is the bookmark code snippet:
private void btnBM(object sender, EventArgs e)
    {
        Line currentLine = scintilla1.Lines.Current;
        if (scintilla1.Markers.GetMarkerMask(currentLine) == 0)
        {
            currentLine.AddMarker(0);
        }
        else
        {
            currentLine.DeleteMarker(0);
        }
    }
I want to clear the previous indicator and put an indicator on the next bookmark, also
scrolling down to focus on the next one
I tried:

scintilla1.Indicators[2].Search(scintilla1.GetRange(), scintilla1.GetRange(scintilla1.CurrentPos)).ClearIndicator(2);
        Range R;
        R = scintilla1.Markers.FindPreviousMarker().Range;   <-- Causes crashes bcoz of index 
            scintilla1.Indicators[2].Style = IndicatorStyle.Box;
            scintilla1.Indicators[2].Color = Color.DarkGoldenrod;
            R.SetIndicator(2);