diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index 1a4d562..e02cf26 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -269,7 +269,6 @@ class TerminalInteractiveShell(InteractiveShell): self.display_formatter.ipython_display_formatter.enabled = False def init_prompt_toolkit_cli(self): - self.reformat_handler = lambda x:x if self.simple_prompt: # Fall back to plain non-interactive output for tests. # This is very limited. diff --git a/IPython/terminal/shortcuts.py b/IPython/terminal/shortcuts.py index ef0f65c..e44e342 100644 --- a/IPython/terminal/shortcuts.py +++ b/IPython/terminal/shortcuts.py @@ -129,7 +129,8 @@ def newline_or_execute_outer(shell): # if all we have after the cursor is whitespace: reformat current text # before cursor - if d.text[d.cursor_position:].isspace(): + after_cursor = d.text[d.cursor_position:] + if not after_cursor.strip(): reformat_text_before_cursor(b, d, shell) if not (d.on_last_line or d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()