(self, console, from_line, bytepos=None)
Output program line to console and position cursor.
Output program line to console and position cursor.
Output program line to console and position cursor .
def edit(self, console, from_line, bytepos=None):
        """Output program line to console and position cursor."""
        if self.protected:
            console.write(b'%d\r' % (from_line,))
            raise error.BASICError(error.IFC)
        # list line
        self.bytecode.seek(self.line_numbers[from_line]+1)
        _, output, textpos = self.lister.detokenise_line(self.bytecode, bytepos)
        # no newline to avoid scrolling on line 24
        console.list_line(bytes(output), newline=False)
        # find row, column position for textpos
        newlines, c = 0, 0
        pos_row, pos_col = 0, 0
        if not output:
            return
        for i, byte in enumerate(output):
            c += 1
            if byte == ord(b'\n') or c > console.width:
                newlines += 1
                c = 0
            if i == textpos:
                pos_row, pos_col = newlines, c
        if textpos > i:
            pos_row, pos_col = newlines, c + 1
        if bytepos:
            console.set_pos(console.current_row-newlines+pos_row, pos_col)
        else:
            console.set_pos(console.current_row-newlines, 1)
def edit ( self , console , from_line , bytepos = None ) : if self . protected : console . write ( b'%d\r' % ( from_line , ) ) raise error . BASICError ( error . IFC ) # list line self . bytecode . seek ( self . line_numbers [ from_line ] + 1 ) _ , output , textpos = self . lister . detokenise_line ( self . bytecode , bytepos ) # no newline to avoid scrolling on line 24 console . list_line ( bytes ( output ) , newline = False ) # find row, column position for textpos newlines , c = 0 , 0 pos_row , pos_col = 0 , 0 if not output : return for i , byte in enumerate ( output ) : c += 1 if byte == ord ( b'\n' ) or c > console . width : newlines += 1 c = 0 if i == textpos : pos_row , pos_col = newlines , c if textpos > i : pos_row , pos_col = newlines , c + 1 if bytepos : console . set_pos ( console . current_row - newlines + pos_row , pos_col ) else : console . set_pos ( console . current_row - newlines , 1 )