aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2020-03-12 23:52:31 +0100
committerMarvin W <git@larma.de>2020-03-14 00:50:27 +0100
commit25751c88ced9d312aef22135ee2f68c2edb71b7e (patch)
tree60e14f91677e2ca5cfb61e3d10320024b5a9316d /main/src
parent2eb72d5dad9be99dc110417144db2f8c4446bd53 (diff)
downloaddino-25751c88ced9d312aef22135ee2f68c2edb71b7e.tar.gz
dino-25751c88ced9d312aef22135ee2f68c2edb71b7e.zip
Properly handle variation selector after emoji (even if useless)
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/util/helper.vala10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index 6b095376..6421473e 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -389,6 +389,12 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa
return s;
}
+/**
+ * This is a heuristic to count emojis in a string {@link http://example.com/}
+ *
+ * @param markup_text string to search in
+ * @return number of emojis, or -1 if text includes non-emojis.
+ */
public int get_only_emoji_count(string markup_text) {
int emoji_no = 0;
int index_ref = 0;
@@ -408,7 +414,9 @@ public int get_only_emoji_count(string markup_text) {
emoji_no--;
}
- if (last_was_emoji && last_was_modifier_base && ICU.has_binary_property(curchar, ICU.Property.EMOJI_MODIFIER)) {
+ if (last_was_emoji && curchar == 0xFE0F) {
+ // Variation selector after emoji is useless, ignoring.
+ } else if (last_was_emoji && last_was_modifier_base && ICU.has_binary_property(curchar, ICU.Property.EMOJI_MODIFIER)) {
// still an emoji, but no longer a modifier base
last_was_modifier_base = false;
} else if (ICU.has_binary_property(curchar, ICU.Property.EMOJI_PRESENTATION)) {