diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py index 49bda87..9b8ef1a 100644 --- a/IPython/core/inputtransformer2.py +++ b/IPython/core/inputtransformer2.py @@ -427,7 +427,7 @@ class TransformerManager: def transform_cell(self, cell: str): if not cell.endswith('\n'): - cell += '\n' # Ensure every line has a newline + cell += '\n' # Ensure the cell has a trailing newline lines = cell.splitlines(keepends=True) for transform in self.cleanup_transforms + self.line_transforms: #print(transform, lines) @@ -454,7 +454,7 @@ class TransformerManager: status is not 'incomplete', this is None. """ if not cell.endswith('\n'): - cell += '\n' # Ensure every line has a newline + cell += '\n' # Ensure the cell has a trailing newline lines = cell.splitlines(keepends=True) if lines[-1][:-1].endswith('\\'): # Explicit backslash continuation diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py index 0d036e1..7e0ad37 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -298,7 +298,7 @@ python-profiler package from non-free.""") list_all=True, posix=False) if cell is not None: arg_str += '\n' + cell - arg_str = self.shell.input_splitter.transform_cell(arg_str) + arg_str = self.shell.input_transformer_manager.transform_cell(arg_str) return self._run_with_profiler(arg_str, opts, self.shell.user_ns) def _run_with_profiler(self, code, opts, namespace): @@ -1033,7 +1033,7 @@ python-profiler package from non-free.""") # this code has tight coupling to the inner workings of timeit.Timer, # but is there a better way to achieve that the code stmt has access # to the shell namespace? - transform = self.shell.input_splitter.transform_cell + transform = self.shell.input_transformer_manager.transform_cell if cell is None: # called as line magic diff --git a/IPython/terminal/shortcuts.py b/IPython/terminal/shortcuts.py index a96338d..b52c34e 100644 --- a/IPython/terminal/shortcuts.py +++ b/IPython/terminal/shortcuts.py @@ -77,7 +77,7 @@ def register_ipython_shortcuts(registry, shell): registry.add_binding(Keys.ControlO, filter=(HasFocus(DEFAULT_BUFFER) - & EmacsInsertMode()))(newline_autoindent_outer(shell.input_splitter)) + & EmacsInsertMode()))(newline_autoindent_outer(shell.input_transformer_manager)) registry.add_binding(Keys.F2, filter=HasFocus(DEFAULT_BUFFER) @@ -119,7 +119,7 @@ def newline_or_execute_outer(shell): check_text = d.text else: check_text = d.text[:d.cursor_position] - status, indent = shell.input_splitter.check_complete(check_text + '\n') + status, indent = shell.input_transformer_manager.check_complete(check_text + '\n') if not (d.on_last_line or d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end() diff --git a/docs/source/config/details.rst b/docs/source/config/details.rst index e1ce0f3..4785c32 100644 --- a/docs/source/config/details.rst +++ b/docs/source/config/details.rst @@ -282,7 +282,7 @@ IPython configuration:: else: # insert a newline with auto-indentation... if document.line_count > 1: text = text[:document.cursor_position] - indent = shell.input_splitter.check_complete(text + '\n')[1] or 0 + indent = shell.input_transformer_manager.check_complete(text)[1] or 0 buffer.insert_text('\n' + ' ' * indent) # if you just wanted a plain newline without any indentation, you