Skip to content

Commit 287fbbc

Browse files
committed
Properly use \r\n removed data string
1 parent cb4e28b commit 287fbbc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utils/vscode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ export class TextHandler {
5252
this._callback = callback;
5353
}
5454

55-
write(data: string, last: boolean) {
56-
const dataNewlineFixed = data.replace(/\r\n/g, '\n'); // just avoid \r\n entirely
55+
write(_data: string, last: boolean) {
56+
const data = _data.replace(/\r\n/g, '\n'); // just avoid \r\n entirely
5757

5858
// Competitive Companion removes trailing spaces for every line
5959
for (let i = 0; i < data.length; i++) {
60-
if (dataNewlineFixed[i] === ' ') {
60+
if (data[i] === ' ') {
6161
this._spacesCount++;
62-
} else if (dataNewlineFixed[i] === '\n') {
62+
} else if (data[i] === '\n') {
6363
this._data += '\n';
6464
this._spacesCount = 0;
6565
} else {
6666
this._data += ' '.repeat(this._spacesCount);
67-
this._data += dataNewlineFixed[i];
67+
this._data += data[i];
6868
this._spacesCount = 0;
6969
}
7070
}

0 commit comments

Comments
 (0)