updated to use new static emoji map for tab completion
This commit is contained in:
@ -66,7 +66,8 @@ func handleTab(viewName string) error {
|
|||||||
// Main tab completion functions
|
// Main tab completion functions
|
||||||
func getEmojiTabCompletionSlice(inputWord string) []string {
|
func getEmojiTabCompletionSlice(inputWord string) []string {
|
||||||
// use the emojiSlice from emojiList.go and filter it for the input word
|
// 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
|
return resultSlice
|
||||||
}
|
}
|
||||||
func getChannelTabCompletionSlice(inputWord string) []string {
|
func getChannelTabCompletionSlice(inputWord string) []string {
|
||||||
@ -151,6 +152,15 @@ func filterStringSlice(ss []string, fv string) []string {
|
|||||||
}
|
}
|
||||||
return rs
|
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 {
|
func longestCommonPrefix(ss []string) string {
|
||||||
// cover the case where the slice has no or one members
|
// cover the case where the slice has no or one members
|
||||||
switch len(ss) {
|
switch len(ss) {
|
||||||
|
|||||||
Reference in New Issue
Block a user