Browse Source

updated to use new static emoji map for tab completion

pull/34/head
David Haukeness 5 years ago
parent
commit
f65ac0e231
No known key found for this signature in database
GPG Key ID: A7F1091956853EF9
  1. 12
      tabComplete.go

12
tabComplete.go

@ -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) {

Loading…
Cancel
Save