mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
The insert path puts the block's opener line right after the anchor's indent (e.g. six spaces plus </body>), which transfers the indent onto the opener line and leaves the anchor unindented in the injected file. The remove path consumed the block's trailing newline but left the pre-block indent behind, producing two bugs in one: Before insert: ` </body>` After remove: ` \n</body>` (orphan indent + unindented anchor) Fix: capture `([ \t]*)` immediately before each marker and replace the whole block (including its trailing newline and any trailing spaces on the ender line) with just the captured indent. The indent now hands itself back to the anchor line that follows — the file round-trips byte-for-byte. New tests/live-inject.test.mjs with four round-trip cases: - HTML file with indented </body> - JSX layout with indented </body> (EAC shape) - Multi-file batch - Column-0 </body> (no indent — already worked; regression baseline) All four pass after the fix. Full suite clean via `bun run test`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>