MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / renderDiffOps

Function renderDiffOps

app/src/modules/renderer.js:145–168  ·  view source on GitHub ↗
(ops, filePath, lineOffset)

Source from the content-addressed store, hash-verified

143}
144
145function renderDiffOps(ops, filePath, lineOffset) {
146 const off = lineOffset || 0;
147 let addCount = 0, delCount = 0;
148 ops.forEach(o => { if (o.type === 'add') addCount++; if (o.type === 'del') delCount++; });
149
150 let rows = '';
151 for (const o of ops) {
152 const cls = o.type === 'del' ? 'diff-del' : o.type === 'add' ? 'diff-add' : 'diff-ctx';
153 const sign = o.type === 'del' ? '-' : o.type === 'add' ? '+' : ' ';
154 const rawLn = o.type === 'del' ? (o.oldLn || '') : (o.newLn || o.oldLn || '');
155 const ln = rawLn !== '' ? rawLn + off : '';
156 rows += `<tr class="${cls}"><td class="diff-ln">${ln}</td><td class="diff-sign">${sign}</td><td class="diff-code">${esc(o.text)}</td></tr>`;
157 }
158
159 const shortPath = shortenPath(filePath);
160 return `<div class="diff-view">
161 <div class="diff-header">
162 <svg class="diff-file-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/></svg>
163 <span class="diff-file-path" title="${esc(filePath)}">${esc(shortPath)}</span>
164 <span class="diff-stats"><span class="ds-add">+${addCount}</span> <span class="ds-del">-${delCount}</span></span>
165 </div>
166 <div class="diff-body"><table class="diff-table">${rows}</table></div>
167 </div>`;
168}
169
170// ---- Step group management ----
171export function closeGroup() {

Callers 2

buildDiffHtmlFunction · 0.70
buildDiffFallbackFunction · 0.70

Calls 2

escFunction · 0.90
shortenPathFunction · 0.90

Tested by

no test coverage detected