def loop(self):
        """
        Main control loop runs the following steps:
            1. Re-draw the screen
            2. Wait for user to press a key (includes terminal resizing)
            3. Trigger the method registered to the input key
            4. Check if there are any nested pages that need to be looped over

        The loop will run until self.active is set to False from within one of
        the methods.
        """
        self.active = True

        # This needs to be called once before the main loop, in case a subpage
        # was pre-selected before the loop started. This happens in __main__.py
        # with ``page.open_submission(url=url)``
        while self.selected_page and self.active:
            self.handle_selected_page()

        while self.active:
            self.draw()
            ch = self.term.stdscr.getch()
            self.controller.trigger(ch)

            while self.selected_page and self.active:
                self.handle_selected_page()

        return self.selected_page

        Main control loop runs the following steps:
            1. Re-draw the screen
            2. Wait for user to press a key (includes terminal resizing)
            3. Trigger the method registered to the input key
            4. Check if there are any nested pages that need to be looped over

        The loop will run until self.active is set to False from within one of
        the methods.
        
rtv/page.py