summaryrefslogtreecommitdiffstats
path: root/modules/emoji/emoji.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/emoji/emoji.go')
-rw-r--r--modules/emoji/emoji.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/emoji/emoji.go b/modules/emoji/emoji.go
index e4b9e5631d..e2c3d202e2 100644
--- a/modules/emoji/emoji.go
+++ b/modules/emoji/emoji.go
@@ -9,7 +9,6 @@ import (
"sort"
"strings"
"sync"
- "unicode/utf8"
)
// Gemoji is a set of emoji data.
@@ -21,6 +20,7 @@ type Emoji struct {
Description string
Aliases []string
UnicodeVersion string
+ SkinTones bool
}
var (
@@ -131,11 +131,12 @@ func ReplaceAliases(s string) string {
func FindEmojiSubmatchIndex(s string) []int {
loadMap()
- // if rune and string length are the same then no emoji will be present
- // similar performance when there is unicode present but almost 200% faster when not
- if utf8.RuneCountInString(s) == len(s) {
+ //see if there are any emoji in string before looking for position of specific ones
+ //no performance difference when there is a match but 10x faster when there are not
+ if s == ReplaceCodes(s) {
return nil
}
+
for j := range GemojiData {
i := strings.Index(s, GemojiData[j].Emoji)
if i != -1 {