Show More
@@ -13,6 +13,7 b' from IPython.utils.terminal import toggle_set_term_title, set_term_title' | |||
|
13 | 13 | from IPython.utils.process import abbrev_cwd |
|
14 | 14 | from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, default, Enum, Union |
|
15 | 15 | |
|
16 | from prompt_toolkit.document import Document | |
|
16 | 17 | from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode |
|
17 | 18 | from prompt_toolkit.filters import (HasFocus, Condition, IsDone) |
|
18 | 19 | from prompt_toolkit.history import InMemoryHistory |
@@ -434,7 +435,18 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
434 | 435 | |
|
435 | 436 | def pre_prompt(self): |
|
436 | 437 | if self.rl_next_input: |
|
437 | self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input) | |
|
438 | # We can't set the buffer here, because it will be reset just after | |
|
439 | # this. Adding a callable to pre_run_callables does what we need | |
|
440 | # after the buffer is reset. | |
|
441 | s = cast_unicode_py2(self.rl_next_input) | |
|
442 | def set_doc(): | |
|
443 | self.pt_cli.application.buffer.document = Document(s) | |
|
444 | if hasattr(self.pt_cli, 'pre_run_callables'): | |
|
445 | self.pt_cli.pre_run_callables.append(set_doc) | |
|
446 | else: | |
|
447 | # Older version of prompt_toolkit; it's OK to set the document | |
|
448 | # directly here. | |
|
449 | set_doc() | |
|
438 | 450 | self.rl_next_input = None |
|
439 | 451 | |
|
440 | 452 | def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED): |
General Comments 0
You need to be logged in to leave comments.
Login now