Skip to content

Loading…

Add a new line before displaying multiline strings in the Qt console. #511

Merged
merged 1 commit into from

2 participants

@takluyver
IPython: interactive computing in Python member

This is more or less copied from the code used by terminal IPython, in IPython/core/displayhook.py, line 230.

Closes gh-510

@minrk
IPython: interactive computing in Python member

seems fine, go ahead and merge.

@takluyver takluyver merged commit 4066b42 into ipython:master
@takluyver
IPython: interactive computing in Python member

Rebased and merged.

@damianavila damianavila referenced this pull request
Commit has since been removed from the repository and is no longer available.
@damianavila damianavila referenced this pull request
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 IPython/frontend/qt/console/ipython_widget.py
View
4 IPython/frontend/qt/console/ipython_widget.py
@@ -184,6 +184,10 @@ def _handle_pyout(self, msg):
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):
Something went wrong with that request. Please try again.