-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/strippable text optimization #9182
Open
ivandrofly
wants to merge
6
commits into
SubtitleEdit:main
Choose a base branch
from
ivandrofly:feature/strippable-text-optimization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/strippable text optimization #9182
ivandrofly
wants to merge
6
commits into
SubtitleEdit:main
from
ivandrofly:feature/strippable-text-optimization
Conversation
This file contains 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
Simplify and optimize logic for stripping text boundaries. Reduces redundant checks and improves maintainability by streamlining character parsing in the constructor. Signed-off-by: Ivandro Jao <[email protected]>
Updated the assertions in the StrippableTextFontDontTouch test to reflect the correct expected values for Pre and StrippedText properties. This ensures the test aligns with the intended behavior and avoids false negatives. Signed-off-by: Ivandro Jao <[email protected]>
ivandrofly
commented
Jan 6, 2025
@@ -57,9 +57,9 @@ public void StrippableTextItalic3() | |||
public void StrippableTextFontDontTouch() | |||
{ | |||
var st = new StrippableText("{MAN} Hi, how are you today!"); | |||
Assert.AreEqual("", st.Pre); | |||
Assert.AreEqual("{", st.Pre); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test was wrong.
We should treat '{' as '[' When it hold hearing impaired word/sentence
Previously, the logic did not account for specific edge cases where the '>' character should not trigger stripping. This update adds a condition to ensure the behavior aligns with expected outcomes, preventing undesired alterations to the input. Signed-off-by: Ivandro Jao <[email protected]>
Introduced a utility method to recognize ASS tags and updated related logic to filter unidentified tags accordingly. Expanded `HtmlUtil` with a set of known HTML tags to improve tag validation and prevent stripping valid structures. Signed-off-by: Ivandro Jao <[email protected]>
Commented out unused closing tags in KnownHtmlTags to clean up the static set. Enhanced `IsKnownHtmlTag` to handle closing tags dynamically, improving flexibility for future use cases. SubtitleEdit@657675f Signed-off-by: Ivandro Jao <[email protected]>
Replaced case-insensitive comparison with StringComparison.Ordinal for closing tags to ensure consistent behavior. This improves clarity and aligns the implementation with best practices for string comparisons. Signed-off-by: Ivandro Jao <[email protected]>
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.
Faster and better algorithm for Strippable Text.
Less allocations