Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(coding-agent): clean up wrapped diff rows (#410)

Sebastian Müllerd06415369842
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index a6705c8a74..546faa9d40 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -2,6 +2,7 @@
## [Unreleased]
+- Changed wrapped diff rows to use a blank hanging gutter.
- Fixed team-gated Prime Inference routes being missing from model selectors by merging the authenticated team catalog during model refresh ([ENG-4645](https://linear.app/primeintellect/issue/ENG-4645/internalglm-52-fast-isnt-working)).
- Added confirmation when fullscreen text selection copies to the clipboard ([ENG-4644](https://linear.app/primeintellect/issue/ENG-4644/copy-issues)).
- Added compact file change stats to collapsed tool calls and an agent-run edit total above the recap.
diff --git a/packages/coding-agent/src/modes/interactive/components/diff.ts b/packages/coding-agent/src/modes/interactive/components/diff.ts
index 93aff236ab..36f939b318 100644
--- a/packages/coding-agent/src/modes/interactive/components/diff.ts
+++ b/packages/coding-agent/src/modes/interactive/components/diff.ts
@@ -171,8 +171,6 @@ function highlightContent(content: string, language: string | undefined): string
interface DiffLineSpec {
bg: ThemeBg;
gutter: string;
- /** Gutter for wrapped continuation rows; defaults to blanks. */
- contGutter?: string;
gutterFg: ThemeColor;
content: string;
language: string | undefined;
@@ -206,8 +204,7 @@ function buildRichDiffLine(spec: DiffLineSpec): string[] {
}
const styledGutter = theme.fg(spec.gutterFg, spec.gutter);
- const cont = spec.contGutter ?? " ".repeat(gutterWidth);
- const styledCont = theme.fg(spec.gutterFg, cont);
+ const styledCont = " ".repeat(gutterWidth);
return contentRows.map((row, index) => {
const gutter = index === 0 ? styledGutter : styledCont;
return theme.bg(spec.bg, padToWidth(`${gutter}${row}\x1b[39m`, spec.width));
@@ -254,8 +251,6 @@ export function renderRichDiff(diffText: string, contentWidth: number, options:
}
const { prefix, lineNum, content } = parsed;
const gutter = ` ${lineNum} ${prefix === " " ? " " : prefix} `;
- // Wrapped rows keep the +/- sign but drop the line number.
- const contGutter = ` ${" ".repeat(lineNum.length)} ${prefix === " " ? " " : prefix} `;
const text = replaceTabs(content);
if (prefix === "+") {
rows.push(
@@ -263,7 +258,6 @@ export function renderRichDiff(diffText: string, contentWidth: number, options:
bg: useBlocks ? "toolDiffAddedBg" : "toolPanelBg",
gutterFg: "toolDiffAdded",
gutter,
- contGutter,
content: text,
language,
width,
@@ -276,7 +270,6 @@ export function renderRichDiff(diffText: string, contentWidth: number, options:
bg: useBlocks ? "toolDiffRemovedBg" : "toolPanelBg",
gutterFg: "toolDiffRemoved",
gutter,
- contGutter,
content: text,
language,
width,
diff --git a/packages/coding-agent/test/ipython-cell-diff.test.ts b/packages/coding-agent/test/ipython-cell-diff.test.ts
index 1af51bba6f..c447689c4a 100644
--- a/packages/coding-agent/test/ipython-cell-diff.test.ts
+++ b/packages/coding-agent/test/ipython-cell-diff.test.ts
@@ -186,19 +186,19 @@ describe("IPythonCellComponent diff rendering", () => {
).not.toThrow();
});
- it("repeats the +/- sign on wrapped continuation rows", () => {
+ it("uses a blank hanging gutter for wrapped diff rows", () => {
const longLine = `const x = ${Array.from({ length: 20 }, (_, i) => `arg${i}`).join(", ")};`;
const out = renderCell({
- code: "await edit(...)",
+ code: "await edit(...) ",
details: { status: "ok", diffs: [{ path: "a.ts", oldStr: "const x = 1;", newStr: longLine, startLine: 1 }] },
executionStarted: true,
argsComplete: true,
expanded: true,
}).split("\n");
- // The added line wraps; every row carrying its content shows a "+" gutter.
const addedRows = out.filter((line) => /arg\d/.test(line));
expect(addedRows.length).toBeGreaterThan(1);
- expect(addedRows.every((line) => /^\s*\+ /.test(line) || /\d+ \+ /.test(line))).toBe(true);
+ expect(addedRows[0]).toMatch(/\d+ \+ /);
+ expect(addedRows.slice(1).every((line) => !line.includes("+"))).toBe(true);
});
it("separates the diff from the summary line with a blank line", () => {