def restore_state(self, index=None):
        """Restore an editor state."""
        if len(self.history) <= 1:
            return False
        if index is None:
            index = self.current_state-1

        if index < 0 or index >= len(self.history):
            return False

        # if self.current_state < len(self.history):
        #     self.current_state = self.current_state-1

        state = self.history[index]
        state.restore(self)
        self.current_state = index
dataset/ETHPy150Open richrd/suplemon/suplemon/editor.py/Editor.restore_state/original