completions.ts: Make sure selected completion options are visible

This commit is contained in:
glacambre 2018-05-01 11:44:35 +02:00
parent c868f61973
commit e4ddeb0cf2
No known key found for this signature in database
GPG key ID: B9625DB1767553AC

View file

@ -76,6 +76,7 @@ abstract class CompletionOptionHTML extends CompletionOption {
switch (newstate) {
case "focused":
this.html.classList.add("focused")
this.html.scrollIntoView()
this.html.classList.remove("hidden")
break
case "normal":
@ -296,8 +297,7 @@ abstract class CompletionSourceFuse extends CompletionSource {
// visopts.length + 1 because we want an empty completion at the end
let max = visopts.length + 1
let opt = visopts[(currind + inc + max) % max]
if (opt)
this.select(opt)
if (opt) this.select(opt)
return true
} else return false
}