diff --git a/ui/src/components/editor/gitGutter.ts b/ui/src/components/editor/gitGutter.ts index b9f4006..cadff0e 100644 --- a/ui/src/components/editor/gitGutter.ts +++ b/ui/src/components/editor/gitGutter.ts @@ -108,6 +108,12 @@ class GitMarker extends GutterMarker { super(); } + /** Text inserted at the line's start pushes the marker down with the line. */ + override startSide = 1; + + /** Same side as the start, so the empty range survives mapping. */ + override endSide = 1; + override eq(other: GutterMarker): boolean { return other instanceof GitMarker && other.kind === this.kind; } diff --git a/ui/tests/editor/gitGutter.test.ts b/ui/tests/editor/gitGutter.test.ts index dc1f314..23168b3 100644 --- a/ui/tests/editor/gitGutter.test.ts +++ b/ui/tests/editor/gitGutter.test.ts @@ -220,6 +220,8 @@ describe("the gutter", () => { expect(markers(view)).toEqual({ 2: "modified" }); view.dispatch({ changes: { from: 0, insert: "new\n" } }); expect(markers(view)).toEqual({ 3: "modified" }); + view.dispatch({ changes: { from: view.state.doc.line(3).from, insert: "typed\n" } }); + expect(markers(view)).toEqual({ 4: "modified" }); engine.answer = { ranges: [], version: 2 }; refreshGitGutters(); await flush();