##// END OF EJS Templates
Make set_next_input work with older versions of prompt_toolkit
Thomas Kluyver -
Show More
@@ -406,7 +406,12 b' class TerminalInteractiveShell(InteractiveShell):'
406 s = cast_unicode_py2(self.rl_next_input)
406 s = cast_unicode_py2(self.rl_next_input)
407 def set_doc():
407 def set_doc():
408 self.pt_cli.application.buffer.document = Document(s)
408 self.pt_cli.application.buffer.document = Document(s)
409 self.pt_cli.pre_run_callables.append(set_doc)
409 if hasattr(self.pt_cli, 'pre_run_callables'):
410 self.pt_cli.pre_run_callables.append(set_doc)
411 else:
412 # Older version of prompt_toolkit; it's OK to set the document
413 # directly here.
414 set_doc()
410 self.rl_next_input = None
415 self.rl_next_input = None
411
416
412 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED):
417 def interact(self, display_banner=DISPLAY_BANNER_DEPRECATED):
General Comments 0
You need to be logged in to leave comments. Login now