(self)
Move the remainder of the line to the next row and wrap (LF).
Move the remainder of the line to the next row and wrap (LF).
Move the remainder of the line to the next row and wrap ( LF ) .
def line_feed(self):
        """Move the remainder of the line to the next row and wrap (LF)."""
        if self.current_col < self.row_length(self.current_row):
            # insert characters, preserving cursor position
            cursor = self.current_row, self.current_col
            self.insert_fullchars(b' ' * (self.mode.width-self.current_col+1))
            self.set_pos(*cursor, scroll_ok=False)
            # adjust end of line and wrapping flag - LF connects lines like word wrap
            self.set_row_length(self.current_row, self.current_col - 1)
            self.set_wrap(self.current_row, True)
            # cursor stays in place after line feed!
        else:
            # find last row in logical line
            end = self.find_end_of_line(self.current_row)
            # if the logical line hits the bottom, start scrolling up to make space...
            if end >= self.scroll_area.bottom:
                # ... until the it also hits the top; then do nothing
                start = self.find_start_of_line(self.current_row)
                if start > self.scroll_area.top:
                    self.scroll()
                else:
                    return
            # self.current_row has changed, don't use row var
            if self.current_row < self.mode.height:
                self.scroll_down(self.current_row+1)
            # ensure the current row now wraps
            self.set_wrap(self.current_row, True)
            # cursor moves to start of next line
            self.set_pos(self.current_row+1, 1)
def line_feed ( self ) : if self . current_col < self . row_length ( self . current_row ) : # insert characters, preserving cursor position cursor = self . current_row , self . current_col self . insert_fullchars ( b' ' * ( self . mode . width - self . current_col + 1 ) ) self . set_pos ( * cursor , scroll_ok = False ) # adjust end of line and wrapping flag - LF connects lines like word wrap self . set_row_length ( self . current_row , self . current_col - 1 ) self . set_wrap ( self . current_row , True ) # cursor stays in place after line feed! else : # find last row in logical line end = self . find_end_of_line ( self . current_row ) # if the logical line hits the bottom, start scrolling up to make space... if end >= self . scroll_area . bottom : # ... until the it also hits the top; then do nothing start = self . find_start_of_line ( self . current_row ) if start > self . scroll_area . top : self . scroll ( ) else : return # self.current_row has changed, don't use row var if self . current_row < self . mode . height : self . scroll_down ( self . current_row + 1 ) # ensure the current row now wraps self . set_wrap ( self . current_row , True ) # cursor moves to start of next line self . set_pos ( self . current_row + 1 , 1 )