def find(view, start_point, selector, forward=True):
    """Given a View, a start point, and a selector, return the first point
    to the right of the start point that matches the selector.

    If `forward=False`, walk left instead."""
    point = start_point if forward else start_point - 1
    max_size = view.size()

    while point >= 0 and point <= max_size:
        if view.match_selector(point, selector):
            return point

        if forward:
            point += 1
        else:
            point -= 1

    return -1