fix: use non-capturing group for highlight boundaries (#5784)
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
- Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818)
|
- Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818)
|
||||||
- Bugfix: Fixed missing word wrap in update popup. (#5811)
|
- Bugfix: Fixed missing word wrap in update popup. (#5811)
|
||||||
- Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794)
|
- Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794)
|
||||||
|
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||||
- Dev: Updated Conan dependencies. (#5776)
|
- Dev: Updated Conan dependencies. (#5776)
|
||||||
|
|
||||||
## 2.5.2
|
## 2.5.2
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#include "controllers/highlights/HighlightPhrase.hpp"
|
#include "controllers/highlights/HighlightPhrase.hpp"
|
||||||
|
|
||||||
|
#include <QStringBuilder>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const QString REGEX_START_BOUNDARY("(\\b|\\s|^)");
|
constexpr QStringView REGEX_START_BOUNDARY(u"(?:\\b|\\s|^)");
|
||||||
const QString REGEX_END_BOUNDARY("(\\b|\\s|$)");
|
constexpr QStringView REGEX_END_BOUNDARY(u"(?:\\b|\\s|$)");
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ HighlightPhrase::HighlightPhrase(const QString &pattern, bool showInMentions,
|
|||||||
, soundUrl_(soundUrl)
|
, soundUrl_(soundUrl)
|
||||||
, regex_(isRegex_
|
, regex_(isRegex_
|
||||||
? pattern
|
? pattern
|
||||||
: REGEX_START_BOUNDARY + QRegularExpression::escape(pattern) +
|
: REGEX_START_BOUNDARY % QRegularExpression::escape(pattern) %
|
||||||
REGEX_END_BOUNDARY,
|
REGEX_END_BOUNDARY,
|
||||||
QRegularExpression::UseUnicodePropertiesOption |
|
QRegularExpression::UseUnicodePropertiesOption |
|
||||||
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
||||||
@@ -69,7 +71,7 @@ HighlightPhrase::HighlightPhrase(const QString &pattern, bool showInMentions,
|
|||||||
, color_(std::move(color))
|
, color_(std::move(color))
|
||||||
, regex_(isRegex_
|
, regex_(isRegex_
|
||||||
? pattern
|
? pattern
|
||||||
: REGEX_START_BOUNDARY + QRegularExpression::escape(pattern) +
|
: REGEX_START_BOUNDARY % QRegularExpression::escape(pattern) %
|
||||||
REGEX_END_BOUNDARY,
|
REGEX_END_BOUNDARY,
|
||||||
QRegularExpression::UseUnicodePropertiesOption |
|
QRegularExpression::UseUnicodePropertiesOption |
|
||||||
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
||||||
|
|||||||
Reference in New Issue
Block a user