def add(self, regions, forward, join):
        total_bytes = sum((len(c) for c in regions))

        if total_bytes == 0:
            return
        index = self.index
        try:
            if not join:
                # if the current item is the same as what we're trying to kill, don't bother
                if self.entries[index] and self.entries[index].same_as(regions):
                    return
            else:
                # try to join
                if self.entries[index] and self.entries[index].join_if_possible(regions, forward):
                    return

            # create the new entry
            index = (index + 1) % self.KILL_RING_SIZE
            self.entries[index] = KillRing.Kill(regions)
        finally:
            self.index = index
            self.entries[index].set_clipboard()

    #
    # Returns the current entry in the kill ring for the purposes of yanking. If pop is
    # non-zero, we move backwards or forwards once in the kill ring and return that data
    # instead. We need to match the specified number of regions or else we cannot return
    # anything with a different number of regions nor can we pop the ring in either
    # direction if the number of regions does not match.
    #
dataset/ETHPy150Open grundprinzip/sublemacspro/jove.py/KillRing.add/original