##// END OF EJS Templates
Fix set_next_input with prompt_toolkit 1.0.10...
Thomas Kluyver -
Show More
@@ -12,6 +12,7 b' from IPython.utils.terminal import toggle_set_term_title, set_term_title'
12 from IPython.utils.process import abbrev_cwd
12 from IPython.utils.process import abbrev_cwd
13 from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, default, Enum, Union
13 from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, default, Enum, Union
14
14
15 from prompt_toolkit.document import Document
15 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
16 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
16 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
17 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
17 from prompt_toolkit.history import InMemoryHistory
18 from prompt_toolkit.history import InMemoryHistory
@@ -399,7 +400,13 b' class TerminalInteractiveShell(InteractiveShell):'
399
400
400 def pre_prompt(self):
401 def pre_prompt(self):
401 if self.rl_next_input:
402 if self.rl_next_input:
402 self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input)
403 # We can't set the buffer here, because it will be reset just after
404 # this. Adding a callable to pre_run_callables does what we need
405 # after the buffer is reset.
406 s = cast_unicode_py2(self.rl_next_input)
407 def set_doc():
408 self.pt_cli.application.buffer.document = Document(s)
409 self.pt_cli.pre_run_callables.append(set_doc)
403 self.rl_next_input = None
410 self.rl_next_input = None
404
411
405 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED):
412 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED):
General Comments 0
You need to be logged in to leave comments. Login now