def find_next_sel(trans_sels, current_sel):
    """Find the region in `trans_sels` that is right after `current_sel`.
    Assume `trans_sels` is sorted.
    """
    for i, sel in enumerate(trans_sels):
        if sel.end() > current_sel.end():
            return i, trans_sels[i]

    # Rotate to the beginning if `current_sel` is after all other selections
    return 0, trans_sels[0]


#### Commands ####
dataset/ETHPy150Open MaokaiLin/PowerCursors/power_cursors.py/find_next_sel/original