code: def reset(self):
          
          self.dirty.update(range(self.lines))
          self.buffer.clear()
          self.margins = None
  
          self.mode = set([mo.DECAWM, mo.DECTCEM])
  
          self.title = ""
          self.icon_name = ""
  
          self.charset = 0
          self.g0_charset = cs.LAT1_MAP
          self.g1_charset = cs.VT100_MAP
  
          # From ``man terminfo`` -- "... hardware tabs are initially
          # set every `n` spaces when the terminal is powered up. Since
          # we aim to support VT102 / VT220 and linux -- we use n = 8.
          self.tabstops = set(range(8, self.columns, 8))
  
          self.cursor = Cursor(0, 0)
          self.cursor_position()
  
          self.saved_columns = None
docs: Reset the terminal to its initial state.
  
          * Scrolling margins are reset to screen boundaries.
          * Cursor is moved to home location -- ``(0, 0)`` and its
            attributes are set to defaults (see :attr:`default_char`).
          * Screen is cleared -- each character is reset to
            :attr:`default_char`.
          * Tabstops are reset to "every eight columns".
          * All lines are marked as :attr:`dirty`.
  
          .. note::
  
             Neither VT220 nor VT102 manuals mention that terminal modes
             and tabstops should be reset as well, thanks to
             :manpage:`xterm` -- we now know that.