Commit 89fa4542 authored by Siong-Ui Te's avatar Siong-Ui Te

minor changes

parent 827dda96
......@@ -7,10 +7,12 @@ import (
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
func modalInputKeyupEventHandler(key string) {
switch key {
case "ArrowUp":
case "ArrowUp", "Up":
println("ArrowUp")
case "ArrowDown":
case "ArrowDown", "Down":
println("ArrowDown")
case "Enter":
println("Enter")
default:
println("default")
}
......
......@@ -86,15 +86,21 @@ func showWordDefinitionInModal(word string) {
SetModalContent(dicmgr.GetWordDefinitionHtml(wi, setting, Window.Navigator().Languages()))
}
func showPossibleWords(word string) {
func FindLongestPrefixWithNonZeroSuggestedWords(word string) string {
for len(word) > 0 {
if len(dicmgr.GetSuggestedWords(word, 10)) > 0 {
break
}
word = lib.RemoveLastChar(word)
}
return word
}
func showPossibleWords(word string) {
prefix := FindLongestPrefixWithNonZeroSuggestedWords(word)
SetModalWords(GetPossibleWordsHtml(word, dicmgr.GetSuggestedWords(word, 7)))
SetModalWords(GetPossibleWordsHtml(prefix, dicmgr.GetSuggestedWords(prefix, 7)))
SetModalInputValue(prefix)
ShowModalInput()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment