code: def _resize_handler(self, *args, **kwarg):  # pylint: disable=unused-argument
          
  
          # Make sure only one resize handler is running
          try:
              assert self.resize_lock
          except AssertionError:
  
              self.resize_lock = True
              term = self.term
  
              term.clear_cache()
              newHeight = term.height
              newWidth = term.width
              lastHeight = lastWidth = 0
  
              while newHeight != lastHeight or newWidth != lastWidth:
                  lastHeight = newHeight
                  lastWidth = newWidth
                  time.sleep(.2)
                  term.clear_cache()
                  newHeight = term.height
                  newWidth = term.width
  
              if newWidth < self.width:
                  offset = (self.scroll_offset - 1) * (1 + self.width // newWidth)
                  term.move_to(0, max(0, newHeight - offset))
                  self.stream.write(term.clear_eos)
  
              self.width = newWidth
              self._set_scroll_area(force=True)
  
              for cter in self.counters:
                  cter.refresh(flush=False)
              self.stream.flush()
  
              self.resize_lock = False
docs: Called when a window resize signal is detected
  
          Resets the scroll window