// Rendering a unified diff is a self-contained concern with its own size // limits, kept out of views.js so that file stays within the project's // architecture budget. // A regenerated lock file runs into tens of thousands of lines, and one element // per line freezes the window. Only the rendered view is capped. const DIFF_RENDER_LINE_LIMIT = 2000; function diffAtmosphere(diff, allLines = null) { if (!ui.selectedFile) return ""; const lines = allLines || String(diff || "").split("\n"); const additions = lines.filter( (line) => line.startsWith("+") && !line.startsWith("+++"), ).length; const removals = lines.filter( (line) => line.startsWith("-") && !line.startsWith("---"), ).length; const extension = String(ui.selectedFile).split(".").pop()?.slice(0, 8).toUpperCase() || "FILE"; return `
`; } function diffLineType(line) { if (line.startsWith("+") && !line.startsWith("+++")) return "add"; if (line.startsWith("-") && !line.startsWith("---")) return "remove"; return line.startsWith("@@") ? "hunk" : ""; } function renderDiff(diff) { if (!diff) return 'Select another file or open the project folder for binary changes.