diff --git a/IPython/frontend/qt/console/frontend_widget.py b/IPython/frontend/qt/console/frontend_widget.py index 7afb714..ad21249 100644 --- a/IPython/frontend/qt/console/frontend_widget.py +++ b/IPython/frontend/qt/console/frontend_widget.py @@ -54,6 +54,14 @@ class FrontendHighlighter(PygmentsHighlighter): PygmentsHighlighter.highlightBlock(self, qstring) + def rehighlightBlock(self, block): + """ Reimplemented to temporarily enable highlighting if disabled. + """ + old = self.highlighting_on + self.highlighting_on = True + super(FrontendHighlighter, self).rehighlightBlock(block) + self.highlighting_on = old + def setFormat(self, start, count, format): """ Reimplemented to highlight selectively. """ diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index 19ead6d..2478b90 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -155,12 +155,9 @@ class IPythonWidget(FrontendWidget): self._prompt = self._insert_html_fetching_plain_text( cursor, prompt) - # XXX: When the HTML is inserted, Qt blows away the syntax - # highlighting for the line. I cannot for the life of me - # determine how to preserve the existing formatting. - self._highlighter.highlighting_on = True + # When the HTML is inserted, Qt blows away the syntax + # highlighting for the line, so we need to rehighlight it. self._highlighter.rehighlightBlock(cursor.block()) - self._highlighter.highlighting_on = False self._previous_prompt_obj = None diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 9ed616f..bcdf342 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -86,7 +86,7 @@ class Kernel(Configurable): If true, an 'import *' is done from numpy and pylab. """ # FIXME: This is adapted from IPython.lib.pylabtools.pylab_activate. - # Common funtionality should be refactored. + # Common functionality should be refactored. # We must set the desired backend before importing pylab. import matplotlib @@ -118,7 +118,6 @@ class Kernel(Configurable): def start(self): """ Start the kernel main loop. """ - while True: ident = self.reply_socket.recv() assert self.reply_socket.rcvmore(), "Missing message part."