(self, row, col, c, attr)
Insert one halfwidth character at the given position.
Insert one halfwidth character at the given position.
Insert one halfwidth character at the given position .
def _insert_at(self, row, col, c, attr):
        """Insert one halfwidth character at the given position."""
        if self.row_length(row) < self.mode.width:
            # insert the new char and ignore what drops off at the end
            # this changes the attribute of everything that has been redrawn
            self._apage.insert_char_attr(row, col, c, attr)
            # the insert has now filled the row and we used to be a row ending in LF:
            # scroll and continue into the new row
            if self.wraps(row) and self.row_length(row) == self.mode.width:
                # since we used to be an LF row, wrap == True already
                # then, the newly added row should wrap - TextBuffer.scroll_down takes care of this
                self.scroll_down(row+1)
            # if we filled out the row but aren't wrapping, we scroll & wrap at the *next* insert
            return True
        else:
            # we have therow.end == width, so we're pushing the end of the row past the screen edge
            # if we're not a wrapping line, make space by scrolling and wrap into the new line
            if not self.wraps(row) and row < self.scroll_area.bottom:
                self.scroll_down(row+1)
                self.set_wrap(row, True)
            if row >= self.scroll_area.bottom:
                # once the end of the line hits the bottom, start scrolling the start of the line up
                start = self.find_start_of_line(self.current_row)
                # if we hist the top of the screen, stop inserting & drop chars
                if start <= self.scroll_area.top:
                    return False
                # scroll up
                self.scroll()
                # adjust working row number
                row -= 1
            popped_char = self._apage.insert_char_attr(row, col, c, attr)
            # insert the character in the next row
            return self._insert_at(row+1, 1, popped_char, attr)
def _insert_at ( self , row , col , c , attr ) : if self . row_length ( row ) < self . mode . width : # insert the new char and ignore what drops off at the end # this changes the attribute of everything that has been redrawn self . _apage . insert_char_attr ( row , col , c , attr ) # the insert has now filled the row and we used to be a row ending in LF: # scroll and continue into the new row if self . wraps ( row ) and self . row_length ( row ) == self . mode . width : # since we used to be an LF row, wrap == True already # then, the newly added row should wrap - TextBuffer.scroll_down takes care of this self . scroll_down ( row + 1 ) # if we filled out the row but aren't wrapping, we scroll & wrap at the *next* insert return True else : # we have therow.end == width, so we're pushing the end of the row past the screen edge # if we're not a wrapping line, make space by scrolling and wrap into the new line if not self . wraps ( row ) and row < self . scroll_area . bottom : self . scroll_down ( row + 1 ) self . set_wrap ( row , True ) if row >= self . scroll_area . bottom : # once the end of the line hits the bottom, start scrolling the start of the line up start = self . find_start_of_line ( self . current_row ) # if we hist the top of the screen, stop inserting & drop chars if start <= self . scroll_area . top : return False # scroll up self . scroll ( ) # adjust working row number row -= 1 popped_char = self . _apage . insert_char_attr ( row , col , c , attr ) # insert the character in the next row return self . _insert_at ( row + 1 , 1 , popped_char , attr )