diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py index 6e1a9d8..5ccbe9e 100644 --- a/IPython/frontend/qt/console/console_widget.py +++ b/IPython/frontend/qt/console/console_widget.py @@ -772,7 +772,7 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): """ # Determine where to insert the content. cursor = self._control.textCursor() - if before_prompt and not self._executing: + if before_prompt and (self._reading or not self._executing): cursor.setPosition(self._append_before_prompt_pos) else: cursor.movePosition(QtGui.QTextCursor.End) diff --git a/IPython/frontend/qt/console/frontend_widget.py b/IPython/frontend/qt/console/frontend_widget.py index 1f62432..2c36047 100644 --- a/IPython/frontend/qt/console/frontend_widget.py +++ b/IPython/frontend/qt/console/frontend_widget.py @@ -597,7 +597,9 @@ class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin): self.kernel_manager.restart_kernel(now=now) except RuntimeError: self._append_plain_text('Kernel started externally. ' - 'Cannot restart.\n') + 'Cannot restart.\n', + before_prompt=True + ) else: self.reset() else: @@ -605,7 +607,9 @@ class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin): else: self._append_plain_text('Kernel process is either remote or ' - 'unspecified. Cannot restart.\n') + 'unspecified. Cannot restart.\n', + before_prompt=True + ) #--------------------------------------------------------------------------- # 'FrontendWidget' protected interface