Skip to content

Commit

Permalink
Improve notebook output stream initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Sep 26, 2024
1 parent fd184a5 commit 4826325
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions javascript/src/ycell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,12 +793,13 @@ export class YCodeCell
const { text, ...outputWithoutText } = output;
_newOutput1 = outputWithoutText;
const newText = new Y.Text();
let length = 0;
// text is a list of strings
for (const str of text as string[]) {
newText.insert(length, str);
length += str.length;
let _text: string;
if (text instanceof Array) {
_text = text.join();
} else {
_text = text as string;
}
newText.insert(0, _text);
_newOutput1['text'] = newText;
} else {
_newOutput1 = output;
Expand Down

0 comments on commit 4826325

Please sign in to comment.