diff --git a/package.json b/package.json index eed2aaa..8055877 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "prettier": "^3.6.2", "rollup-plugin-visualizer": "^6.0.3", "typescript": "^5.9.2", - "vite": "^7.1.4" + "vite": "^7.1.5" }, "dependencies": { "@mantine/core": "^8.2.8", diff --git a/src/utils/terminal.ts b/src/utils/terminal.ts index ea74c02..1d0f36d 100644 --- a/src/utils/terminal.ts +++ b/src/utils/terminal.ts @@ -5,19 +5,29 @@ export const handleTerminalOutput = ( newData: string ): string => { try { - if (newData.includes('\r') && !newData.includes('\r\n')) { - const lines = (prevContent + newData).split('\n'); + if (newData.includes('\r')) { + const hasStandaloneCarriageReturns = /\r(?!\n)/g.test(newData); + + if (hasStandaloneCarriageReturns) { + const combined = prevContent + newData; + + const lines = combined.split(/(\r?\n)/); + const processedLines: string[] = []; + + for (let i = 0; i < lines.length; i += 2) { + const line = lines[i] || ''; + const lineBreak = lines[i + 1] || ''; - return lines - .map((line) => { if (line.includes('\r')) { const parts = line.split('\r'); - return parts[parts.length - 1]; + processedLines.push(parts[parts.length - 1] + lineBreak); + } else { + processedLines.push(line + lineBreak); } + } - return line; - }) - .join('\n'); + return processedLines.join('').replace(/\r?\n$/, ''); + } } return prevContent + newData; diff --git a/yarn.lock b/yarn.lock index 09fb2de..c11ec69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3656,7 +3656,7 @@ __metadata: rollup-plugin-visualizer: "npm:^6.0.3" systeminformation: "npm:^5.27.8" typescript: "npm:^5.9.2" - vite: "npm:^7.1.4" + vite: "npm:^7.1.5" winston: "npm:^3.17.0" winston-daily-rotate-file: "npm:^5.0.0" zustand: "npm:^5.0.8" @@ -6731,7 +6731,7 @@ __metadata: languageName: node linkType: hard -"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.14": +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.15": version: 0.2.15 resolution: "tinyglobby@npm:0.2.15" dependencies: @@ -7106,9 +7106,9 @@ __metadata: languageName: node linkType: hard -"vite@npm:^7.1.4": - version: 7.1.4 - resolution: "vite@npm:7.1.4" +"vite@npm:^7.1.5": + version: 7.1.5 + resolution: "vite@npm:7.1.5" dependencies: esbuild: "npm:^0.25.0" fdir: "npm:^6.5.0" @@ -7116,7 +7116,7 @@ __metadata: picomatch: "npm:^4.0.3" postcss: "npm:^8.5.6" rollup: "npm:^4.43.0" - tinyglobby: "npm:^0.2.14" + tinyglobby: "npm:^0.2.15" peerDependencies: "@types/node": ^20.19.0 || >=22.12.0 jiti: ">=1.21.0" @@ -7157,7 +7157,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 10c0/dbe2ba29926ffe8985c93d1b3718dcc9040080b7fa10a74c82a52aad7449136a391ba17b265288ff03b864e6f1033b9b537247521a96d5491a9d4af90ac04702 + checksum: 10c0/782d2f20c25541b26d1fb39bef5f194149caff39dc25b7836e25f049ca919f2e2ce186bddb21f3f20f6195354b3579ec637a8ca08d65b117f8b6f81e3e730a9c languageName: node linkType: hard