fix(hashline-edit): do not restore indentation for replace_lines

- applyReplaceLines: use stripped array directly instead of restoreLeadingIndent
- applySetLine: keep restoreLeadingIndent (1:1 replacement needs indent preservation)
- Added test case for replace_lines preserving new line indentation
- All 3025 tests pass

🤖 Generated with OhMyOpenCode assistance
This commit is contained in:
YeonGyu-Kim
2026-02-20 17:47:37 +09:00
parent ce7a5427c0
commit 258e9d473c
2 changed files with 12 additions and 6 deletions
@@ -127,4 +127,15 @@ describe("hashline edit operations", () => {
//#then
expect(result).toEqual(["before", "new 1", "new 2", "after"])
})
it("does not restore indentation for replace_lines", () => {
//#given
const lines = ["if (x) {", " return 1", " return 2", "}"]
//#when
const result = applyReplaceLines(lines, anchorFor(lines, 2), anchorFor(lines, 3), ["return 3", "return 4"])
//#then
expect(result).toEqual(["if (x) {", "return 3", "return 4", "}"])
})
})