code: def index(self):
          
          top, bottom = self.margins or Margins(0, self.lines - 1)
  
          if self.cursor.y == bottom:
              self.history.top.append(self.buffer[top])
  
          super(HistoryScreen, self).index()
docs: Overloaded to update top history with the removed lines.