Skip to content

Commit eac74e2

Browse files
committed
Format FileEditToolCall
1 parent 4d312e6 commit eac74e2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/components/tools/FileEditToolCall.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ function renderDiff(diff: string): React.ReactNode {
207207
if (!patch?.hunks) {
208208
return null;
209209
}
210-
210+
211211
return (
212212
<React.Fragment key={patchIdx}>
213213
{patch.hunks.map((hunk, hunkIdx) => {
214214
if (!hunk?.lines) {
215215
return null;
216216
}
217-
217+
218218
let oldLineNum = hunk.oldStart ?? 0;
219219
let newLineNum = hunk.newStart ?? 0;
220220

@@ -224,14 +224,15 @@ function renderDiff(diff: string): React.ReactNode {
224224
<DiffIndicator type="header">{/* Empty for alignment */}</DiffIndicator>
225225
<LineNumber type="header">{hunkIdx > 0 ? "⋮" : ""}</LineNumber>
226226
<LineContent type="header">
227-
@@ -{hunk.oldStart ?? 0},{hunk.oldLines ?? 0} +{hunk.newStart ?? 0},{hunk.newLines ?? 0} @@
227+
@@ -{hunk.oldStart ?? 0},{hunk.oldLines ?? 0} +{hunk.newStart ?? 0},
228+
{hunk.newLines ?? 0} @@
228229
</LineContent>
229230
</DiffLine>
230231
{hunk.lines.map((line, lineIdx) => {
231-
if (!line || typeof line !== 'string') {
232+
if (!line || typeof line !== "string") {
232233
return null;
233234
}
234-
235+
235236
const firstChar = line[0];
236237
const content = line.slice(1); // Remove the +/- prefix
237238
let type: DiffLineType = "context";
@@ -267,7 +268,7 @@ function renderDiff(diff: string): React.ReactNode {
267268
);
268269
});
269270
} catch (error) {
270-
console.error('Failed to parse diff:', error);
271+
console.error("Failed to parse diff:", error);
271272
// Fallback to raw diff display
272273
return (
273274
<pre style={{ margin: 0, whiteSpace: "pre-wrap", wordBreak: "break-word", fontSize: "11px" }}>

0 commit comments

Comments
 (0)