fix: Emoji regex incorrectly using multiline
This commit is contained in:
parent
ba7a01ddea
commit
d42979da12
|
@ -781,19 +781,19 @@ class Event extends MatrixEvent {
|
||||||
static final RegExp _onlyEmojiRegex = RegExp(
|
static final RegExp _onlyEmojiRegex = RegExp(
|
||||||
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\s)*$',
|
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\s)*$',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
multiLine: true);
|
multiLine: false);
|
||||||
static final RegExp _onlyEmojiEmoteRegex = RegExp(
|
static final RegExp _onlyEmojiEmoteRegex = RegExp(
|
||||||
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$',
|
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
multiLine: true);
|
multiLine: false);
|
||||||
static final RegExp _countEmojiRegex = RegExp(
|
static final RegExp _countEmojiRegex = RegExp(
|
||||||
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])',
|
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
multiLine: true);
|
multiLine: false);
|
||||||
static final RegExp _countEmojiEmoteRegex = RegExp(
|
static final RegExp _countEmojiEmoteRegex = RegExp(
|
||||||
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)',
|
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
multiLine: true);
|
multiLine: false);
|
||||||
|
|
||||||
/// Returns if a given event only has emotes, emojis or whitespace as content.
|
/// Returns if a given event only has emotes, emojis or whitespace as content.
|
||||||
/// This is useful to determine if stand-alone emotes should be displayed bigger.
|
/// This is useful to determine if stand-alone emotes should be displayed bigger.
|
||||||
|
|
|
@ -1171,6 +1171,17 @@ void main() {
|
||||||
}, null);
|
}, null);
|
||||||
expect(event.onlyEmotes, false);
|
expect(event.onlyEmotes, false);
|
||||||
expect(event.numberEmotes, 0);
|
expect(event.numberEmotes, 0);
|
||||||
|
event = Event.fromJson({
|
||||||
|
'type': EventTypes.Message,
|
||||||
|
'content': {
|
||||||
|
'msgtype': 'm.text',
|
||||||
|
'body': 'normal message\n\nvery normal',
|
||||||
|
},
|
||||||
|
'event_id': '\$edit2',
|
||||||
|
'sender': '@alice:example.org',
|
||||||
|
}, null);
|
||||||
|
expect(event.onlyEmotes, false);
|
||||||
|
expect(event.numberEmotes, 0);
|
||||||
event = Event.fromJson({
|
event = Event.fromJson({
|
||||||
'type': EventTypes.Message,
|
'type': EventTypes.Message,
|
||||||
'content': {
|
'content': {
|
||||||
|
|
Loading…
Reference in a new issue