Skip to content
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

refactor: Ignores and Replacements #4965

Merged
merged 11 commits into from
Nov 17, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Nov 14, 2023

Refactors the replacement of ignores. I noticed two additional bugs:

  • Kappa KeepoKeepo Kappa wouldn't add emotes
  • Regex lookahead/-behind wouldn't work

Fixes #2617.
The limit for replacements is 128, if this is reached, the message will be replaced with:
Too many replacements - check your ignores!
I couldn't see a good use-case where these many iterations would make sense.

Additionally:

  • Merged regex and non-regex replacements
  • Use SizeType to support both Qt 5 and 6 (this should be done for more stuff)
  • Added comments to std algorithm
  • Removed a few mutables
  • Use tokenize in Qt 6

It's a bit unfortunate that we still have QRegularExpression emoteregex("\\b" + emote.name.string + "\\b", ..) which will always be cold or at least needs to be compiled for every emote. Maybe we can use QChar::isSpace there?

@Nerixyz Nerixyz force-pushed the refactor/ignore-replace branch from 6c82fc7 to 3d9b300 Compare November 16, 2023 19:27
@pajlada pajlada merged commit 3d9db1d into Chatterino:master Nov 17, 2023
15 checks passed
@Nerixyz Nerixyz deleted the refactor/ignore-replace branch November 17, 2023 16:48
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.

"$" in ignore regex causes Chatterino to stop responding
2 participants