DS-2321 Outputs and inputs are mixed

GitOrigin-RevId: b543da51f729739413501e4cdff3ffe2b811e496
This commit is contained in:
Elizaveta Shashkova
2021-10-20 13:05:39 +00:00
committed by intellij-monorepo-bot
parent f4cb70d9e8
commit 5eb047fe70
@@ -12,10 +12,7 @@ class PyDevDisplayHook(DisplayHook):
super(PyDevDisplayHook, self).write_format_data(format_dict, *args,
**kwargs)
return
if "text/plain" in format_dict:
text = format_dict["text/plain"]
if len(text) > 0 and not text.endswith("\n"):
format_dict["text/plain"] = text + "\n"
add_new_line_to_text(format_dict)
format_dict["execution_count"] = str(self.shell.execution_count)
send_rich_output(format_dict)
@@ -26,9 +23,17 @@ class PyDevDisplayPub(DisplayPublisher):
if not is_supported(data):
super(PyDevDisplayPub, self).publish(data, *args, **kwargs)
return
add_new_line_to_text(data)
send_rich_output(data)
def add_new_line_to_text(format_dict):
if "text/plain" in format_dict:
text = format_dict["text/plain"]
if len(text) > 0 and not text.endswith("\n"):
format_dict["text/plain"] = text + "\n"
def is_supported(data):
for type in data.keys():
if type not in ("text/plain", "image/png", "text/html"):