Merge branch 'master' of https://github.com/chatterino/Chatterino2
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
const QString REGEX_START_BOUNDARY("(\\b|\\s|^)");
|
||||
const QString REGEX_END_BOUNDARY("(\\b|\\s|$)");
|
||||
|
||||
} // namespace
|
||||
|
||||
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
||||
QColor HighlightPhrase::FALLBACK_REDEEMED_HIGHLIGHT_COLOR =
|
||||
QColor(28, 126, 141, 90);
|
||||
@@ -27,8 +34,10 @@ HighlightPhrase::HighlightPhrase(const QString &pattern, bool hasAlert,
|
||||
, isRegex_(isRegex)
|
||||
, isCaseSensitive_(isCaseSensitive)
|
||||
, soundUrl_(soundUrl)
|
||||
, regex_(isRegex_ ? pattern
|
||||
: "\\b" + QRegularExpression::escape(pattern) + "\\b",
|
||||
, regex_(isRegex_
|
||||
? pattern
|
||||
: REGEX_START_BOUNDARY + QRegularExpression::escape(pattern) +
|
||||
REGEX_END_BOUNDARY,
|
||||
QRegularExpression::UseUnicodePropertiesOption |
|
||||
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
||||
: QRegularExpression::CaseInsensitiveOption))
|
||||
@@ -47,8 +56,10 @@ HighlightPhrase::HighlightPhrase(const QString &pattern, bool hasAlert,
|
||||
, isCaseSensitive_(isCaseSensitive)
|
||||
, soundUrl_(soundUrl)
|
||||
, color_(color)
|
||||
, regex_(isRegex_ ? pattern
|
||||
: "\\b" + QRegularExpression::escape(pattern) + "\\b",
|
||||
, regex_(isRegex_
|
||||
? pattern
|
||||
: REGEX_START_BOUNDARY + QRegularExpression::escape(pattern) +
|
||||
REGEX_END_BOUNDARY,
|
||||
QRegularExpression::UseUnicodePropertiesOption |
|
||||
(isCaseSensitive_ ? QRegularExpression::NoPatternOption
|
||||
: QRegularExpression::CaseInsensitiveOption))
|
||||
|
||||
@@ -4,10 +4,14 @@
|
||||
#include "util/RapidJsonSerializeQString.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
|
||||
#include <QColor>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <pajlada/serialize.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class HighlightPhrase
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
enum class ColorType {
|
||||
|
||||
Reference in New Issue
Block a user