Skip to content

Fix: overlapping italic / bold could case exception#34

Merged
TrueBrain merged 1 commit intomainfrom
bug-bold-italic
Jun 7, 2023
Merged

Fix: overlapping italic / bold could case exception#34
TrueBrain merged 1 commit intomainfrom
bug-bold-italic

Conversation

@TrueBrain
Copy link
Copy Markdown
Owner

Take the string:

''a''' ''b'' zz'''c''

Here the bold and italic are overlapping. The Bold part is:

''' ''b'' zz'''

The Italic parts are:

''a''' '' and '' zz'''c''

The problem here is that while replacing the first, the internal shadow variable of the last Italic part is no longer matching the actual string. The zz gives just enough offset, that the match on the last Italic object now returns None, instead of the actual match.

This can be solved by first replacing the closing tag of the Bold with something that is of equal size than the closing string, so: three characters. That way the shadow of the Italic entries remain correct, and replacement works out fine.

In all of the cases we have seen this so far, it was always user-error for having unbalanced ', but that shouldn't cause a crash, ofc.

@TrueBrain TrueBrain changed the title fix: overlapping italic / bold could case exception Fix: overlapping italic / bold could case exception Jun 7, 2023
@TrueBrain TrueBrain merged commit 8e5c10c into main Jun 7, 2023
@TrueBrain TrueBrain deleted the bug-bold-italic branch June 7, 2023 09:36
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