Skip to content

escape comment trailing dash only on the final chunk in speed saver#78

Open
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:comment-dash-chunk-boundary
Open

escape comment trailing dash only on the final chunk in speed saver#78
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:comment-dash-chunk-boundary

Conversation

@aizu-m

@aizu-m aizu-m commented Jul 8, 2026

Copy link
Copy Markdown

Saving a comment longer than 512 chars with setSaveOptimizeForSpeed(true) lost a hyphen:

in:  <!--aaa...(511)...a-bbb...b-->
out: <!--aaa...(511)...a bbb...b-->

The '-' at index 511 sits on a chunk boundary. OptimizedForSpeedSaver emits comment text in 512-char chunks, and entitizeAndWriteCommentText ran its trailing-dash fixup at the end of every chunk, so a lone '-' that happened to fall on a boundary was rewritten to a space even though it was in the middle of the comment. The dash state was reset per chunk too.

That fixup is only wanted at the real end of the comment, to stop the text forming '--->' with the closing delimiter. TextSaver.entitizeComment already does that in a single pass. Threaded lastWasDash across the chunks and gated the fixup on the final chunk, matching the default saver and the pi emitter next to it.

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