Autocomplete
Autocomplete copied to clipboard
Words should be sorted with shortest first
Autocomplete is pretty good (thanks for the work) but...
Quite often I'm trying to write a word and Autocomplete suggests words which are much longer than the one I want, and the first few often have "'s" appended, which is seldom what I want.
Indeed, when I just wrote "seldom", it was number 6 on the list, when it should have been number 1 because it was a full valid word in itself.
Is this something that can be implemented? I imagine a sort by ascending length would not take much processing time.
I used following code in new ahk file to sort wordlist
FileRead, text, WordList.txt
if not ErrorLevel ; Successfully loaded.
{
Sort, text, F SortFunc
FileDelete, WordList.txt
FileAppend, %text%, WordList.txt
msgbox % text
text = ; Free the memory.
}
SortFunc(lineA, lineB, offset)
{
; Return positive if lineA is longer than line B.
; Return negative if lineA is shorter than line B.
if StrLen(lineA) != StrLen(lineB)
return StrLen(lineA)-StrLen(lineB)
; Use offset to try to preserve the order in the file when two lines are of equal length.
return -offset
}
it sorted the file content in ascending order based on each words length. This works for me. (tried code from here)