Show More
@@ -149,6 +149,9 b' class DisplayHook(Configurable):' | |||
|
149 | 149 | """ |
|
150 | 150 | return self.shell.display_formatter.format(result) |
|
151 | 151 | |
|
152 | # This can be set to True by the write_output_prompt method in a subclass | |
|
153 | prompt_end_newline = False | |
|
154 | ||
|
152 | 155 | def write_format_data(self, format_dict, md_dict=None): |
|
153 | 156 | """Write the format data dict to the frontend. |
|
154 | 157 | |
@@ -179,8 +182,7 b' class DisplayHook(Configurable):' | |||
|
179 | 182 | # because the expansion may add ANSI escapes that will interfere |
|
180 | 183 | # with our ability to determine whether or not we should add |
|
181 | 184 | # a newline. |
|
182 | prompt_template = self.shell.prompt_manager.out_template | |
|
183 | if prompt_template and not prompt_template.endswith('\n'): | |
|
185 | if not self.prompt_end_newline: | |
|
184 | 186 | # But avoid extraneous empty lines. |
|
185 | 187 | result_repr = '\n' + result_repr |
|
186 | 188 |
@@ -42,8 +42,11 b' class RichPromptDisplayHook(DisplayHook):' | |||
|
42 | 42 | """Subclass of base display hook using coloured prompt""" |
|
43 | 43 | def write_output_prompt(self): |
|
44 | 44 | sys.stdout.write(self.shell.separate_out) |
|
45 | self.prompt_end_newline = False | |
|
45 | 46 | if self.do_full_cache: |
|
46 | 47 | tokens = self.shell.prompts.out_prompt_tokens() |
|
48 | if tokens and tokens[-1][1].endswith('\n'): | |
|
49 | self.prompt_end_newline = True | |
|
47 | 50 | if self.shell.pt_cli: |
|
48 | 51 | self.shell.pt_cli.print_tokens(tokens) |
|
49 | 52 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now