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(
|
||||
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\s)*$',
|
||||
caseSensitive: false,
|
||||
multiLine: true);
|
||||
multiLine: false);
|
||||
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)*$',
|
||||
caseSensitive: false,
|
||||
multiLine: true);
|
||||
multiLine: false);
|
||||
static final RegExp _countEmojiRegex = RegExp(
|
||||
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])',
|
||||
caseSensitive: false,
|
||||
multiLine: true);
|
||||
multiLine: false);
|
||||
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)[^>]*>)',
|
||||
caseSensitive: false,
|
||||
multiLine: true);
|
||||
multiLine: false);
|
||||
|
||||
/// 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.
|
||||
|
|
|
@ -1171,6 +1171,17 @@ void main() {
|
|||
}, null);
|
||||
expect(event.onlyEmotes, false);
|
||||
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({
|
||||
'type': EventTypes.Message,
|
||||
'content': {
|
||||
|
|
Loading…
Reference in a new issue