def _append_custom(self, insert, input, before_prompt=False):
<EOL>cursor = self._control.textCursor()<EOL>if before_prompt and (self._reading or not self._executing):<EOL><INDENT>cursor.setPosition(self._append_before_prompt_pos)<EOL><DEDENT>else:<EOL><INDENT>cursor.movePosition(QtGui.QTextCursor.End)<EOL><DEDENT>start_pos = cursor.position()<EOL>result = insert(cursor, input)<EOL>if before_prompt and not self._executing:<EOL><INDENT>diff = cursor.position() - start_pos<EOL>self._append_before_prompt_pos += diff<EOL>self._prompt_pos += diff<EOL><DEDENT>return result<EOL>
A low-level method for appending content to the end of the buffer.

        If 'before_prompt' is enabled, the content will be inserted before the
        current prompt, if there is one.