Skip to content

Fix empty Text event emitted with trim_text_end (#984) - #997

Draft
dralley wants to merge 2 commits into
tafia:masterfrom
dralley:empty-text2
Draft

Fix empty Text event emitted with trim_text_end (#984)#997
dralley wants to merge 2 commits into
tafia:masterfrom
dralley:empty-text2

Conversation

@dralley

@dralley dralley commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

When trim_text_end is enabled, whitespace-only text before markup or a reference is now suppressed instead of producing an empty Text("") event.

closes #984

dralley added 2 commits July 31, 2026 09:53
When trim_text_end is enabled, whitespace-only text before markup or
a reference is now suppressed instead of producing an empty Text("") event.

closes tafia#984
The comment claimed `<` was consumed, but `read_text` never consumes
it, `<` is consumed later by `read_with` inside `read_until_close`.
Comment thread src/reader/mod.rs
$self.config_mut().trim_text_start = trim;
let config = $self.config_mut();
config.trim_text_start = trim_start;
config.trim_text_end = trim_end;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the clear->restore pattern, but it was already like this. Would be nice to refactor this away

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also does not like it here... I was thinking about removing auto-trim altogether and making it an explicit method call on the Event

@dralley

dralley commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

replaces #993 and #986

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.09%. Comparing base (e00ae5c) to head (95ccb87).
⚠️ Report is 33 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #997      +/-   ##
==========================================
- Coverage   57.31%   56.09%   -1.22%     
==========================================
  Files          46       47       +1     
  Lines       18197    18429     +232     
==========================================
- Hits        10429    10338      -91     
- Misses       7768     8091     +323     
Flag Coverage Δ
unittests 56.09% <100.00%> (-1.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

trim_text_end still emits an empty Text event for whitespace-only text before a tag

3 participants