remove duplicates in autocompletion

This commit is contained in:
Gokcehan committed 2018-12-29 20:20:45 +03:00
1 parent 7e3f92f049
commit 8dd3f692b8
1 file changed
+9
+9
View File
@@ -275,6 +275,15 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) {
words = append(words, c)
}
sort.Strings(words)
j := 0
for i := 1; i < len(words); i++ {
if words[j] == words[i] {
continue
}
j++
words[i], words[j] = words[j], words[i]
}
words = words[:j+1]
matches, longest = matchWord(s, words)
longestAcc = []rune(longest)
case 2: