##// END OF EJS Templates
Empty prompt effectively ends with newline...
Thomas Kluyver -
Show More
@@ -62,11 +62,15 b' class RichPromptDisplayHook(DisplayHook):'
62 """Subclass of base display hook using coloured prompt"""
62 """Subclass of base display hook using coloured prompt"""
63 def write_output_prompt(self):
63 def write_output_prompt(self):
64 sys.stdout.write(self.shell.separate_out)
64 sys.stdout.write(self.shell.separate_out)
65 self.prompt_end_newline = False
65 # If we're not displaying a prompt, it effectively ends with a newline,
66 # because the output will be left-aligned.
67 self.prompt_end_newline = True
68
66 if self.do_full_cache:
69 if self.do_full_cache:
67 tokens = self.shell.prompts.out_prompt_tokens()
70 tokens = self.shell.prompts.out_prompt_tokens()
68 if tokens and tokens[-1][1].endswith('\n'):
71 if tokens and not tokens[-1][1].endswith('\n'):
69 self.prompt_end_newline = True
72 # Ask for a newline before multiline output
73 self.prompt_end_newline = False
70 if self.shell.pt_cli:
74 if self.shell.pt_cli:
71 self.shell.pt_cli.print_tokens(tokens)
75 self.shell.pt_cli.print_tokens(tokens)
72 else:
76 else:
General Comments 0
You need to be logged in to leave comments. Login now