Range GetNextPrevBookmark(Range range, bool next, bool selecting)
        {
            int index;

            if (next)
            {
                index = Bookmarks.BinaryFindFirst(r => r.Start > range.Cursor);
                if (index == -1)
                {
                    index = 0;
                }
            }
            else
            {
                index = Bookmarks.BinaryFindLast(r => r.Start < range.Cursor);
                if (index == -1)
                {
                    index = Bookmarks.Count - 1;
                }
            }
            return(MoveCursor(range, Bookmarks[index].Start, selecting));
        }