Permalink
Browse files

minor improvements to text placement in qtconsole

* allow `before_prompt=True` behavior to have effect during raw_input
* append 'cannot restart' message before the prompt, so it doesn't
  get mixed up with input.
  • Loading branch information...
1 parent f15123a commit ae00badb64d511ff6b5e2ae31110fe5d225402e3 @minrk minrk committed Nov 15, 2011
Showing with 7 additions and 3 deletions.
  1. +1 −1 IPython/frontend/qt/console/console_widget.py
  2. +6 −2 IPython/frontend/qt/console/frontend_widget.py
@@ -772,7 +772,7 @@ def _append_custom(self, insert, input, before_prompt=False):
"""
# 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)
@@ -597,15 +597,19 @@ def restart_kernel(self, message, now=False):
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:
self.kernel_manager.hb_channel.unpause()
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

0 comments on commit ae00bad

Please sign in to comment.