def _show_prompt(self, prompt=None, html=False, newline=True,
                     separator=True):
        """ Writes a new prompt at the end of the buffer.

        Parameters
        ----------
        prompt : str, optional
            The prompt to show. If not specified, the previous prompt is used.

        html : bool, optional (default False)
            Only relevant when a prompt is specified. If set, the prompt will
            be inserted as formatted HTML. Otherwise, the prompt will be treated
            as plain text, though ANSI color codes will be handled.

        newline : bool, optional (default True)
            If set, a new line will be written before showing the prompt if
            there is not already a newline at the end of the buffer.

        separator : bool, optional (default True)
            If set, a separator will be written before the prompt.
        """
        self._flush_pending_stream()

        # This is necessary to solve out-of-order insertion of mixed stdin and
        # stdout stream texts.
        # Fixes spyder-ide/spyder#17710
        if sys.platform == 'darwin':
            # Although this makes our tests hang on Mac, users confirmed that
            # it's needed on that platform too.
            # Fixes spyder-ide/spyder#19888
            if not os.environ.get('QTCONSOLE_TESTING'):
                QtCore.QCoreApplication.processEvents()
        else:
            QtCore.QCoreApplication.processEvents()

        cursor = self._get_end_cursor()

        # Save the current position to support _append*(before_prompt=True).
        # We can't leave the cursor at the end of the document though, because
        # that would cause any further additions to move the cursor. Therefore,
        # we move it back one place and move it forward again at the end of
        # this method. However, we only do this if the cursor isn't already
        # at the start of the text.
        if cursor.position() == 0:
            move_forward = False
        else:
            move_forward = True
            self._append_before_prompt_cursor.setPosition(cursor.position() - 1)

        # Insert a preliminary newline, if necessary.
        if newline and cursor.position() > 0:
            cursor.movePosition(QtGui.QTextCursor.Left,
                                QtGui.QTextCursor.KeepAnchor)
            if cursor.selection().toPlainText() != '\n':
                self._append_block()

        # Write the prompt.
        if separator:
            self._append_plain_text(self._prompt_sep)

        if prompt is None:
            if self._prompt_html is None:
                self._append_plain_text(self._prompt)
            else:
                self._append_html(self._prompt_html)
        else:
            if html:
                self._prompt = self._append_html_fetching_plain_text(prompt)
                self._prompt_html = prompt
            else:
                self._append_plain_text(prompt)
                self._prompt = prompt
                self._prompt_html = None

        self._flush_pending_stream()
        self._prompt_cursor.setPosition(self._get_end_pos() - 1)

        if move_forward:
            self._append_before_prompt_cursor.setPosition(
                self._append_before_prompt_cursor.position() + 1)
        self._prompt_started()
 Writes a new prompt at the end of the buffer.

        Parameters
        ----------
        prompt : str, optional
            The prompt to show. If not specified, the previous prompt is used.

        html : bool, optional (default False)
            Only relevant when a prompt is specified. If set, the prompt will
            be inserted as formatted HTML. Otherwise, the prompt will be treated
            as plain text, though ANSI color codes will be handled.

        newline : bool, optional (default True)
            If set, a new line will be written before showing the prompt if
            there is not already a newline at the end of the buffer.

        separator : bool, optional (default True)
            If set, a separator will be written before the prompt.
        
angrmanagement/vendor/qtconsole/console_widget.py