def _draw_header(self):
        """
        Draw the title bar at the top of the screen
        """
        n_rows, n_cols = self.term.stdscr.getmaxyx()

        # Note: 2 argument form of derwin breaks PDcurses on Windows 7!
        window = self.term.stdscr.derwin(1, n_cols, self._row, 0)
        window.erase()
        # curses.bkgd expects bytes in py2 and unicode in py3
        window.bkgd(str(' '), self.term.attr('TitleBar'))

        sub_name = self.content.name
        sub_name = sub_name.replace('/r/front', 'Front Page')

        parts = sub_name.split('/')
        if len(parts) == 1:
            pass
        elif '/m/' in sub_name:
            _, _, user, _, multi = parts
            sub_name = '{} Curated by {}'.format(multi, user)
        elif parts[1] == 'u':
            noun = 'My' if parts[2] == 'me' else parts[2] + "'s"
            user_room = parts[3] if len(parts) == 4 else 'overview'
            title_lookup = {
                'overview': 'Overview',
                'submitted': 'Submissions',
                'comments': 'Comments',
                'saved': 'Saved Content',
                'hidden': 'Hidden Content',
                'upvoted': 'Upvoted Content',
                'downvoted': 'Downvoted Content'
            }
            sub_name = "{} {}".format(noun, title_lookup[user_room])

        query = self.content.query
        if query:
            sub_name = 'Searching {0}: {1}'.format(sub_name, query)
        self.term.add_line(window, sub_name, 0, 0)

        # Set the terminal title
        if len(sub_name) > 50:
            title = sub_name.strip('/')
            title = title.replace('_', ' ')
            try:
                title = title.rsplit('/', 1)[1]
            except IndexError:
                pass
        else:
            title = sub_name

        # Setting the terminal title will break emacs or systems without
        # X window.
        if os.getenv('DISPLAY') and not os.getenv('INSIDE_EMACS'):
            title += ' - rtv {0}'.format(__version__)
            title = self.term.clean(title)
            if six.PY3:
                # In py3 you can't write bytes to stdout
                title = title.decode('utf-8')
                title = '\x1b]2;{0}\x07'.format(title)
            else:
                title = b'\x1b]2;{0}\x07'.format(title)
            sys.stdout.write(title)
            sys.stdout.flush()

        if self.reddit and self.reddit.user is not None:
            # The starting position of the name depends on if we're converting
            # to ascii or not
            width = len if self.config['ascii'] else textual_width

            if self.config['hide_username']:
                username = "Logged in"
            else:
                username = self.reddit.user.name
            s_col = (n_cols - width(username) - 1)
            # Only print username if it fits in the empty space on the right
            if (s_col - 1) >= width(sub_name):
                self.term.add_line(window, username, 0, s_col)

        self._row += 1
Draw the title bar at the top of the screen