Beispiel #1
0
def is_regions_intersected(region1: sublime.Region,
                           region2: sublime.Region,
                           allow_boundary: bool = False) -> bool:
    """
    @brief Determinates whether two regions are intersected.

    @param region1        The 1st region
    @param region2        The 2nd region
    @param allow_boundary Treat boundary contact as intersected

    @return True if intersected, False otherwise.
    """

    return region1.intersects(region2) or (allow_boundary and len(
        {*region1.to_tuple(), *region2.to_tuple()}) != 4)