diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index 79a5108..9a32b4d 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -190,7 +190,7 @@ class IPythonWidget(FrontendWidget): if self._previous_prompt_obj and \ self._previous_prompt_obj.number != previous_prompt_number: block = self._previous_prompt_obj.block - if block.isValid(): + if block.isValid() and not block.text().isEmpty(): # Remove the old prompt and insert a new prompt. cursor = QtGui.QTextCursor(block)