Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Oct 11, 2022
1 parent 1bf062f commit f9d02ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/vs/workbench/contrib/notebook/common/notebookCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,13 @@ export function isTextStreamMime(mimeType: string) {
}


const textDecoder = new TextDecoder();

/**
* Given a stream of individual stdout outputs, this function will return the compressed lines, escaping some of the common terminal escape codes.
* E.g. some terminal escape codes would result in the previous line getting cleared, such if we had 3 lines and
* last line contained such a code, then the result string would be just the first two lines.
*/
const textDecoder = new TextDecoder();
export function compressOutputItemStreams(outputs: Uint8Array[]) {
const buffers: Uint8Array[] = [];
let startAppending = false;
Expand Down Expand Up @@ -1005,9 +1005,11 @@ function compressStreamBuffer(streams: Uint8Array[]) {



// Took this from jupyter/notebook
// https://github.com/jupyter/notebook/blob/b8b66332e2023e83d2ee04f83d8814f567e01a4e/notebook/static/base/js/utils.js
// Remove characters that are overridden by backspace characters
/**
* Took this from jupyter/notebook
* https://github.com/jupyter/notebook/blob/b8b66332e2023e83d2ee04f83d8814f567e01a4e/notebook/static/base/js/utils.js
* Remove characters that are overridden by backspace characters
*/
function fixBackspace(txt: string) {
let tmp = txt;
do {
Expand All @@ -1018,9 +1020,10 @@ function fixBackspace(txt: string) {
return txt;
}

// Remove chunks that should be overridden by the effect of
// carriage return characters
// From https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/utils.js
/**
* Remove chunks that should be overridden by the effect of carriage return characters
* From https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/utils.js
*/
function fixCarriageReturn(txt: string) {
txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline
while (txt.search(/\r[^$]/g) > -1) {
Expand Down

0 comments on commit f9d02ea

Please sign in to comment.