##// END OF EJS Templates
Fix switching prompts in doctest mode
Thomas Kluyver -
Show More
@@ -98,6 +98,7 b' class TerminalInteractiveShell(InteractiveShell):'
98 98
99 99 pt_cli = None
100 100 debugger_history = None
101 _pt_app = None
101 102
102 103 simple_prompt = Bool(_use_simple_prompt,
103 104 help="""Use `raw_input` for the REPL, without completion, multiline input, and prompt colors.
@@ -203,7 +204,6 b' class TerminalInteractiveShell(InteractiveShell):'
203 204 self.display_formatter.active_types = ['text/plain']
204 205
205 206 def init_prompt_toolkit_cli(self):
206 self._app = None
207 207 if self.simple_prompt:
208 208 # Fall back to plain non-interactive output for tests.
209 209 # This is very limited, and only accepts a single line.
@@ -350,7 +350,7 b' class TerminalInteractiveShell(InteractiveShell):'
350 350
351 351 editing_mode = getattr(EditingMode, self.editing_mode.upper())
352 352
353 self._app = create_prompt_application(
353 self._pt_app = create_prompt_application(
354 354 editing_mode=editing_mode,
355 355 key_bindings_registry=kbmanager.registry,
356 356 history=history,
@@ -361,7 +361,7 b' class TerminalInteractiveShell(InteractiveShell):'
361 361 **self._layout_options()
362 362 )
363 363 self._eventloop = create_eventloop(self.inputhook)
364 self.pt_cli = CommandLineInterface(self._app, eventloop=self._eventloop)
364 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self._eventloop)
365 365
366 366 def _make_style_from_name(self, name):
367 367 """
@@ -432,8 +432,8 b' class TerminalInteractiveShell(InteractiveShell):'
432 432 Ask for a re computation of the application layout, if for example ,
433 433 some configuration options have changed.
434 434 """
435 if getattr(self, '._app', None):
436 self._app.layout = create_prompt_layout(**self._layout_options())
435 if self._pt_app:
436 self._pt_app.layout = create_prompt_layout(**self._layout_options())
437 437
438 438 def prompt_for_code(self):
439 439 document = self.pt_cli.run(
@@ -563,6 +563,7 b' class TerminalInteractiveShell(InteractiveShell):'
563 563 elif self._prompts_before:
564 564 self.prompts = self._prompts_before
565 565 self._prompts_before = None
566 self._update_layout()
566 567
567 568
568 569 InteractiveShellABC.register(TerminalInteractiveShell)
General Comments 0
You need to be logged in to leave comments. Login now