#NEWLINE# def erase_in_display( self , type_of = 0 , private = False ) : #NEWLINE# #INDENT# 'Erases display in a specific way.\n\n        :param int type_of: defines the way the line should be erased in:\n\n            * ``0`` -- Erases from cursor to end of screen, including\n              cursor position.\n            * ``1`` -- Erases from beginning of screen to cursor,\n              including cursor position.\n            * ``2`` -- Erases complete display. All lines are erased\n              and changed to single-width. Cursor does not move.\n            * ``3`` -- Erase saved lines. (Xterm) Clears the history.\n        :param bool private: when ``True`` character attributes aren left\n                             unchanged **not implemented**.\n        ' #NEWLINE# line_offset = self . line_offset #NEWLINE# pt_cursor_position = self . pt_cursor_position #NEWLINE# if ( type_of == 3 ) : #NEWLINE# #INDENT# for y in list ( self . data_buffer ) : #NEWLINE# #INDENT# self . data_buffer . pop ( y , None ) #NEWLINE# #UNINDENT# pt_cursor_position . y = 0 #NEWLINE# self . max_y = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# interval = ( range ( ( pt_cursor_position . y + 1 ) , ( line_offset + self . lines ) ) , range ( line_offset , pt_cursor_position . y ) , range ( line_offset , ( line_offset + self . lines ) ) ) [ type_of ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# data_buffer = self . data_buffer #NEWLINE# for line in interval : #NEWLINE# #INDENT# data_buffer [ line ] = defaultdict ( ( lambda : Char ( ' ' ) ) ) #NEWLINE# #UNINDENT# if ( type_of in [ 0 , 1 ] ) : #NEWLINE# #INDENT# self . erase_in_line ( type_of )