def clean_editing_area(self):
        """Blit bg color over editing area to clean it."""
        ### reference topleft coordinates of text editor
        x, y = self.rect.topleft

        ### obtain a rect which covers the editing area
        ### plus the lineno area

        area_to_clean = Rect(
            ## left is the same as the text editor's, but
            ## one pixel to the right
            TEXT_EDITOR_RECT.left + 1,
            ## top is same as editing area's, but one pixel
            ## higher
            EDITING_AREA_RECT.top - 1,
            ## the width is the same as the text editor's,
            ## but 2 pixels shorter
            TEXT_EDITOR_RECT.width - 2,
            ## height is same as editing area's, but 2 pixels
            ## higher
            EDITING_AREA_RECT.height + 2,
            ## we move the resulting rect by the opposite of
            ## the topleft of the self.rect.topleft (the
            ## text editor rect), which makes it so the
            ## rect position represents its position relative
            ## to the text editor rect, rather than relative
            ## to the screen)
        ).move(-x, -y)

        ### now finally use the rect to blit the background
        ### color over the blitting area in order to clean it

        draw_rect(self.image, WINDOW_BG, area_to_clean)
Blit bg color over editing area to clean it.
nodezator/textman/editor/main.py