code: def interactive_mode(self):
          
          if PLATFORM == 'win32':
              # Defaulting to 80 on windows, better ideas are welcome, but the
              # solutions I found online are rather bulky
              height = 20
              width = 80
          else:
              height, width = os.popen('stty size', 'r').read().split()
              width = int(width)
              height = int(height)
  
          message_no = 0
          page_no = 0
          action = None
          while action != 'q':
              page_no = self.__update_window(width, height, message_no, page_no)
              action = getch()
              if action == 's':
                  # Coerce in range
                  message_no = \
                      max(min(len(self.messages) - 1, message_no + 1), 0)
                  page_no = 0
              elif action == 'w':
                  # Coerce in range
                  message_no = \
                      max(min(len(self.messages) - 1, message_no - 1), 0)
                  page_no = 0
              elif action == 'a':
                  page_no -= 1
              elif action == 'd':
                  page_no += 1
              elif action == 'b':
                  self.__to_browser(message_no)
              elif action == 'f':
                  self.__to_file(message_no)
docs: Interactive mode