##// END OF EJS Templates
Implement pre-filling prompt from set_next_input()
Thomas Kluyver -
Show More
@@ -152,11 +152,19 b' class PTInteractiveShell(InteractiveShell):'
152 152 def ask_exit(self):
153 153 self.keep_running = False
154 154
155 rl_next_input = None
156
157 def pre_prompt(self):
158 if self.rl_next_input:
159 self.pt_cli.application.buffer.text = self.rl_next_input
160 self.rl_next_input = None
161
155 162 def interact(self):
156 163 while self.keep_running:
157 164 print(self.separate_in, end='')
165
158 166 try:
159 document = self.pt_cli.run()
167 document = self.pt_cli.run(pre_run=self.pre_prompt)
160 168 except EOFError:
161 169 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
162 170 self.ask_exit()
General Comments 0
You need to be logged in to leave comments. Login now