mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 10:01:39 -05:00
Mitigate #917 until we get our heads around async
This commit is contained in:
parent
263b4d3fa6
commit
c51bdc87c7
1 changed files with 15 additions and 12 deletions
|
@ -55,18 +55,21 @@ export class ExcmdCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async scoreOptions(exstrs: string[]) {
|
private async scoreOptions(exstrs: string[]) {
|
||||||
let histpos = state.cmdHistory.map(s => s.split(" ")[0]).reverse()
|
return exstrs
|
||||||
return exstrs.sort((a, b) => {
|
|
||||||
let posa = histpos.findIndex(x => x == a)
|
// Too slow with large profiles
|
||||||
let posb = histpos.findIndex(x => x == b)
|
// let histpos = state.cmdHistory.map(s => s.split(" ")[0]).reverse()
|
||||||
// If two ex commands have the same position, sort lexically
|
// return exstrs.sort((a, b) => {
|
||||||
if (posa == posb) return a < b ? -1 : 1
|
// let posa = histpos.findIndex(x => x == a)
|
||||||
// If they aren't found in the list they get lower priority
|
// let posb = histpos.findIndex(x => x == b)
|
||||||
if (posa == -1) return 1
|
// // If two ex commands have the same position, sort lexically
|
||||||
if (posb == -1) return -1
|
// if (posa == posb) return a < b ? -1 : 1
|
||||||
// Finally, sort by history position
|
// // If they aren't found in the list they get lower priority
|
||||||
return posa < posb ? -1 : 1
|
// if (posa == -1) return 1
|
||||||
})
|
// if (posb == -1) return -1
|
||||||
|
// // Finally, sort by history position
|
||||||
|
// return posa < posb ? -1 : 1
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
select(option: ExcmdCompletionOption) {
|
select(option: ExcmdCompletionOption) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue