def merge_selections(selections):
    """
    This function merges selections with overlapping lines
    """
    if len(selections) < 2:
        return selections
    merged_selections = []
    skip_flag = False
    for i in range(1, len(selections)):
        previous_start_line = selections[i - 1][0]
        previous_end_line = selections[i - 1][1]
        current_start_line = selections[i][0]
        current_end_line = selections[i][1]
        if previous_end_line == current_start_line and not skip_flag:
            merged_selections.append((previous_start_line, current_end_line))
            skip_flag = True
        else:
            if not skip_flag:
                merged_selections.append((previous_start_line,
                    previous_end_line))
            skip_flag = False
            if i == len(selections) - 1:
                merged_selections.append((current_start_line, current_end_line)
                    )
    return merged_selections
