##// 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 def ask_exit(self):
152 def ask_exit(self):
153 self.keep_running = False
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 def interact(self):
162 def interact(self):
156 while self.keep_running:
163 while self.keep_running:
157 print(self.separate_in, end='')
164 print(self.separate_in, end='')
165
158 try:
166 try:
159 document = self.pt_cli.run()
167 document = self.pt_cli.run(pre_run=self.pre_prompt)
160 except EOFError:
168 except EOFError:
161 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
169 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'):
162 self.ask_exit()
170 self.ask_exit()
General Comments 0
You need to be logged in to leave comments. Login now