Skip to content

Commit

Permalink
Paratext: Fix \qs parsing
Browse files Browse the repository at this point in the history
When converting to non-Paratext formats, `\qs` is treated as paragraph
style instead of character style. Therefore, whitespace before it needs
to be normalized.

This normalization failed with ArrayIndexOutOfBoundsException in case
the `\qs` was the first element of its parent element.
  • Loading branch information
schierlm committed Oct 25, 2024
1 parent 989d0dc commit da6b686
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void fixTrailingWhitespace(ParatextCharacterContentContainer cc) {
if (!suffix.isEmpty()) {
cc.getContent().add(i + 1, Text.from(suffix));
}
if (((AutoClosingFormatting) cc.getContent().get(i)).getKind().getLineBreakKind() == ExtendedLineBreakKind.SAME_LINE_IF_POSSIBLE) {
if (i > 0 && ((AutoClosingFormatting) cc.getContent().get(i)).getKind().getLineBreakKind() == ExtendedLineBreakKind.SAME_LINE_IF_POSSIBLE) {
ParatextCharacterContentPart last = cc.getContent().get(i-1);
if (last instanceof AutoClosingFormatting) {
extractTrailingWhitespace((AutoClosingFormatting) last);
Expand Down

0 comments on commit da6b686

Please sign in to comment.