Fix unclosed style marker crash - #364
Open
benjaminking wants to merge 2 commits into
Open
Conversation
An unclosed character style is closed implicitly by the next paragraph marker. end_char consumed tokens through state.index even on an implicit close, so that paragraph marker was pulled into the block being closed and dropped along with the removed style. In a non-verse paragraph it also left the place markers handler holding a paragraph element marked for removal, which satisfied the early-out guard but produced nothing to place, raising IndexError. - end_char only consumes tokens when the style is explicitly closed, as end_note and end_sidebar already did - end_note mirrors start_note for duplicate verses, which end_char had been masking by consuming the end marker first - the place markers early-out guard is derived from a single _is_placeable predicate so it cannot disagree with element collection, plus an explicit check for nothing left to place - OTHER elements no longer count as content when locating end-of-verse paragraph markers, which was moving embeds past them - TEXT elements are read in full: a verse range matched by several rows has one token per row, and reading only the first dropped the rest of the translation Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR corrects a few different errors that could occur with marker placement, due to unmatched markers in the source, one of which was causing a crash, and the others leading to incorrect output:
OTHERcould cause markers to be placed out of orderend_notewas behaving inconsistently in duplicated versesThis change is