Skip to content

Copy trailing comments in SectionData copy constructor - #260

Open
haraldrohan wants to merge 1 commit into
rickyah:release/2.6.0from
haraldrohan:fix/156-clone-trailing-comments
Open

haraldrohan wants to merge 1 commit into
rickyah:release/2.6.0from
haraldrohan:fix/156-clone-trailing-comments

Conversation

@haraldrohan

Copy link
Copy Markdown

The SectionData copy constructor copies LeadingComments but not TrailingComments, so SectionData.Clone() silently drops them. This is the fix suggested in #156.

Adds a test that checks both comment lists survive a clone and that the copy is independent of the original.

Note: comments at the end of a section that are read by the parser are stored as leading comments of the next section, so IniData.Clone() on parsed data was not affected in my checks. The loss occurs when TrailingComments are set on a SectionData and that section is cloned.

Refs #156

🤖 Generated with Claude Code

The copy constructor copied the leading comments but not the trailing
comments, so cloning a SectionData dropped them.

Refs rickyah#156

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant