fix(hashline-edit): restore leading indentation for first line in replace_lines
- BUG-21: Apply restoreLeadingIndent to first entry of replace_lines, matching set_line behavior - Update test to verify indentation preservation
This commit is contained in:
@@ -128,7 +128,7 @@ describe("hashline edit operations", () => {
|
||||
expect(result).toEqual(["before", "new 1", "new 2", "after"])
|
||||
})
|
||||
|
||||
it("does not restore indentation for replace_lines", () => {
|
||||
it("restores indentation for first replace_lines entry", () => {
|
||||
//#given
|
||||
const lines = ["if (x) {", " return 1", " return 2", "}"]
|
||||
|
||||
@@ -136,6 +136,6 @@ describe("hashline edit operations", () => {
|
||||
const result = applyReplaceLines(lines, anchorFor(lines, 2), anchorFor(lines, 3), ["return 3", "return 4"])
|
||||
|
||||
//#then
|
||||
expect(result).toEqual(["if (x) {", "return 3", "return 4", "}"])
|
||||
expect(result).toEqual(["if (x) {", " return 3", "return 4", "}"])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user