From f65ac0e23113b8deeddfd5bed4a9f87ebe0dd2d1 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Sat, 19 Oct 2019 14:53:14 -0600 Subject: [PATCH] updated to use new static emoji map for tab completion --- tabComplete.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tabComplete.go b/tabComplete.go index 4aaabd7..45451e8 100644 --- a/tabComplete.go +++ b/tabComplete.go @@ -66,7 +66,8 @@ func handleTab(viewName string) error { // Main tab completion functions func getEmojiTabCompletionSlice(inputWord string) []string { // use the emojiSlice from emojiList.go and filter it for the input word - resultSlice := filterStringSlice(emojiSlice, inputWord) + //resultSlice := filterStringSlice(emojiSlice, inputWord) + resultSlice := filterEmojiMap(emojiMap, inputWord) return resultSlice } func getChannelTabCompletionSlice(inputWord string) []string { @@ -151,6 +152,15 @@ func filterStringSlice(ss []string, fv string) []string { } return rs } +func filterEmojiMap(eMap map[string]emojiData, fv string) []string { + var rs []string + for k, _ := range eMap { + if strings.HasPrefix(k, fv) { + rs = append(rs, k) + } + } + return rs +} func longestCommonPrefix(ss []string) string { // cover the case where the slice has no or one members switch len(ss) {