fix(core): resolve Windows line ending and path separation bugs across CLI (#21068)

This commit is contained in:
Muhammad Usman
2026-03-10 03:40:22 +05:00
committed by GitHub
parent 1fd42802be
commit f88488d1f9
4 changed files with 5 additions and 6 deletions

View File

@@ -156,7 +156,7 @@ export function colorizeCode({
try {
// Render the HAST tree using the adapted theme
// Apply the theme's default foreground color to the top-level Text element
let lines = codeToHighlight.split('\n');
let lines = codeToHighlight.split(/\r?\n/);
const padWidth = String(lines.length).length; // Calculate padding width based on number of lines
let hiddenLinesCount = 0;
@@ -225,7 +225,7 @@ export function colorizeCode({
);
// Fall back to plain text with default color on error
// Also display line numbers in fallback
const lines = codeToHighlight.split('\n');
const lines = codeToHighlight.split(/\r?\n/);
const padWidth = String(lines.length).length; // Calculate padding width based on number of lines
const fallbackLines = lines.map((line, index) => (
<Box key={index} minHeight={1}>