Skip to content

Fix indented writer misaligning End tags after Comment + Text - #996

Draft
dralley wants to merge 2 commits into
tafia:masterfrom
dralley:writer-indentation
Draft

Fix indented writer misaligning End tags after Comment + Text #996
dralley wants to merge 2 commits into
tafia:masterfrom
dralley:writer-indentation

Conversation

@dralley

@dralley dralley commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

When an element contained a non-text child (e.g. Comment) followed by a
Text event, the closing End tag lost its line break because Text
unconditionally cleared should_line_break. Track the indent level of the
most recent non-text event and force a line break for the End tag when
that level is deeper than the current level after shrink.

closes #276

@dralley
dralley force-pushed the writer-indentation branch from 05b0d27 to e0f60bf Compare July 30, 2026 21:39
When an element contained a non-text child (e.g. Comment) followed by a
Text event, the closing End tag lost its line break because Text
unconditionally cleared should_line_break. Track the indent level of the
most recent non-text event and force a line break for the End tag when
that level is deeper than the current level after shrink.

closes tafia#276
@dralley
dralley force-pushed the writer-indentation branch from e0f60bf to 4fb1699 Compare July 30, 2026 21:45
@dralley

dralley commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

Unless I mark it ready for review, it's not ready yet!

@dralley
dralley force-pushed the writer-indentation branch from d80502f to cda93fc Compare July 30, 2026 22:00
@dralley

dralley commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

To be clear, I'm still experimenting with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in writing XML with indents

1 participant