mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 09:57:24 +00:00
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
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user