fix: editor renders standalone committed deletions neutral; doc/comment cleanups (final review)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
BenStullsBets
2026-06-26 18:10:25 -07:00
parent 02fbe9c77e
commit c3cecdfaa2
3 changed files with 39 additions and 18 deletions
+15
View File
@@ -286,6 +286,21 @@ test("committed change with NO shared prefix: current offsets + deleted text bot
expect(plan.deletions.some((d) => d.text.includes("alpha"))).toBe(true); // deletion not lost
});
test("standalone committed deletion → plan has no insertions (controller routes del to neutral)", () => {
// current = "keep word" (baseline had "this " between "keep " and "word" — standalone deletion)
const [h] = wordEditHunks("keep word", "keep this word");
const plan = decorationPlan(h.start, h.replacement, "keep word".slice(h.start, h.end));
expect(plan.insertions.length).toBe(0);
expect(plan.deletions.some((d) => d.text.includes("this"))).toBe(true);
});
test("paired committed replace → plan has insertions (deletion inherits author, not neutral)", () => {
// current = "the dark mode", baseline = "the light mode" — replacement, so paired
const [h] = wordEditHunks("the dark mode", "the light mode");
const plan = decorationPlan(h.start, h.replacement, "the dark mode".slice(h.start, h.end));
expect(plan.insertions.length).toBeGreaterThan(0);
});
describe("renderPlain", () => {
test("renderPlain renders current buffer as plain markdown (no marks)", () => {
const html = renderPlain("# Title\n\nhello");