(self, fromline, toline)
Delete range of lines from stored program.
Delete range of lines from stored program.
Delete range of lines from stored program .
def delete(self, fromline, toline):
        """Delete range of lines from stored program."""
        fromline, toline = self.explicit_lines(fromline, toline)
        fromline = fromline if fromline is not None else min(self.line_numbers)
        toline = toline if toline is not None else 65535
        startpos, afterpos, deleteable, beyond = self.find_pos_line_dict(fromline, toline)
        if not deleteable:
            # no lines selected
            raise error.BASICError(error.IFC)
        # do the delete
        self.bytecode.seek(afterpos)
        rest = self.bytecode.read()
        self.bytecode.seek(startpos)
        self.truncate(rest)
        # update line number dict
        self.update_line_dict(startpos, afterpos, 0, deleteable, beyond)
def delete ( self , fromline , toline ) : fromline , toline = self . explicit_lines ( fromline , toline ) fromline = fromline if fromline is not None else min ( self . line_numbers ) toline = toline if toline is not None else 65535 startpos , afterpos , deleteable , beyond = self . find_pos_line_dict ( fromline , toline ) if not deleteable : # no lines selected raise error . BASICError ( error . IFC ) # do the delete self . bytecode . seek ( afterpos ) rest = self . bytecode . read ( ) self . bytecode . seek ( startpos ) self . truncate ( rest ) # update line number dict self . update_line_dict ( startpos , afterpos , 0 , deleteable , beyond )