|
|
|
@ -66,7 +66,8 @@ func handleTab(viewName string) error {
@@ -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 {
@@ -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) { |
|
|
|
|