diff --git a/plugins/kernels/fps_kernels/kernel_driver/driver.py b/plugins/kernels/fps_kernels/kernel_driver/driver.py index 362bbbfc..9cba3074 100644 --- a/plugins/kernels/fps_kernels/kernel_driver/driver.py +++ b/plugins/kernels/fps_kernels/kernel_driver/driver.py @@ -1,3 +1,4 @@ +import os import time import uuid from typing import Any, Dict, Optional, cast @@ -258,6 +259,9 @@ async def _handle_outputs(self, outputs: Array, msg: Dict[str, Any]): if msg_type == "stream": with outputs.doc.transaction(): # TODO: uncomment when changes are made in jupyter-ydoc + text = content["text"] + if text.endswith(os.linesep): + text = text[:-1] if (not outputs) or (outputs[-1]["name"] != content["name"]): # type: ignore outputs.append( # Map( @@ -270,13 +274,13 @@ async def _handle_outputs(self, outputs: Array, msg: Dict[str, Any]): { "name": content["name"], "output_type": msg_type, - "text": [content["text"]], + "text": [text], } ) else: # outputs[-1]["text"].append(content["text"]) # type: ignore last_output = outputs[-1] - last_output["text"].append(content["text"]) # type: ignore + last_output["text"].append(text) # type: ignore outputs[-1] = last_output elif msg_type in ("display_data", "execute_result"): if "application/vnd.jupyter.ywidget-view+json" in content["data"]: