From 4066b4225de39f144d22f89e23b7837096cd4d55 2011-06-10 20:33:53 From: Thomas Kluyver Date: 2011-06-10 20:33:53 Subject: [PATCH] Add a new line before displaying multiline strings in the Qt console. Closes gh-510 --- diff --git a/IPython/frontend/qt/console/ipython_widget.py b/IPython/frontend/qt/console/ipython_widget.py index 6fa8053..50f6b3a 100644 --- a/IPython/frontend/qt/console/ipython_widget.py +++ b/IPython/frontend/qt/console/ipython_widget.py @@ -184,6 +184,10 @@ class IPythonWidget(FrontendWidget): self._append_plain_text(self.output_sep) self._append_html(self._make_out_prompt(prompt_number)) text = data['text/plain'] + # If the repr is multiline, make sure we start on a new line, + # so that its lines are aligned. + if "\n" in text and not self.output_sep.endswith("\n"): + self._append_plain_text('\n') self._append_plain_text(text + self.output_sep2) def _handle_display_data(self, msg):