##// END OF EJS Templates
Fix newline check when prompt consists of empty token
Thomas Kluyver -
Show More
@@ -68,10 +68,12 b' class RichPromptDisplayHook(DisplayHook):'
68
68
69 if self.do_full_cache:
69 if self.do_full_cache:
70 tokens = self.shell.prompts.out_prompt_tokens()
70 tokens = self.shell.prompts.out_prompt_tokens()
71 if tokens and not tokens[-1][1].endswith('\n'):
71 prompt_txt = ''.join(s for t, s in tokens)
72 if prompt_txt and not prompt_txt.endswith('\n'):
72 # Ask for a newline before multiline output
73 # Ask for a newline before multiline output
73 self.prompt_end_newline = False
74 self.prompt_end_newline = False
75
74 if self.shell.pt_cli:
76 if self.shell.pt_cli:
75 self.shell.pt_cli.print_tokens(tokens)
77 self.shell.pt_cli.print_tokens(tokens)
76 else:
78 else:
77 sys.stdout.write(''.join(s for t, s in tokens))
79 sys.stdout.write(prompt_txt)
General Comments 0
You need to be logged in to leave comments. Login now