diff --git a/src/commandline_frame.ts b/src/commandline_frame.ts
index e1679a9f..6b527764 100644
--- a/src/commandline_frame.ts
+++ b/src/commandline_frame.ts
@@ -285,7 +285,7 @@ clInput.addEventListener("input", () => {
if (exstr != clInput.value) return
onInputPromise = refresh_completions(exstr)
- }, 1)
+ }, 100)
})
/** @hidden **/
diff --git a/src/completions.ts b/src/completions.ts
index f32a760e..3ce9d2a4 100644
--- a/src/completions.ts
+++ b/src/completions.ts
@@ -42,10 +42,13 @@ export abstract class CompletionSource {
let commands = aliases.getCmdAliasMapping()
// Now, for each prefix given as argument, add it to the completionsource's prefix list and also add any alias it has
- prefixes.map(p => p.trim()).forEach(p => {
- this.prefixes.push(p)
- if (commands[p]) this.prefixes = this.prefixes.concat(commands[p])
- })
+ prefixes
+ .map(p => p.trim())
+ .forEach(p => {
+ this.prefixes.push(p)
+ if (commands[p])
+ this.prefixes = this.prefixes.concat(commands[p])
+ })
// Not sure this is necessary but every completion source has it
this.prefixes = this.prefixes.map(p => p + " ")
@@ -143,7 +146,7 @@ export abstract class CompletionSourceFuse extends CompletionSource {
public options: CompletionOptionFuse[]
protected lastExstr: string
- protected optionContainer = html`
`
+ protected optionContainer = html``
constructor(prefixes, className: string, title?: string) {
super(prefixes)
@@ -162,7 +165,7 @@ export abstract class CompletionSourceFuse extends CompletionSource {
public async filter(exstr: string) {
this.lastExstr = exstr
await this.onInput(exstr)
- await this.updateChain()
+ return this.updateChain()
}
updateChain(exstr = this.lastExstr, options = this.options) {
diff --git a/src/completions/Bmark.ts b/src/completions/Bmark.ts
index 97dcf30b..622f7794 100644
--- a/src/completions/Bmark.ts
+++ b/src/completions/Bmark.ts
@@ -22,13 +22,15 @@ class BmarkCompletionOption extends Completions.CompletionOptionHTML
const favIconUrl = Completions.DEFAULT_FAVICON
// const favIconUrl = tab.favIconUrl ? tab.favIconUrl : DEFAULT_FAVICON
this.html = html`
- ${"".padEnd(2)} |
- |
- ${bmark.title} |
- ${bmark.url} |
-
`
+ ${"".padEnd(2)} |
+ |
+ ${bmark.title} |
+
+ ${bmark.url}
+ |
+ `
}
}
@@ -67,7 +69,7 @@ export class BmarkCompletionSource extends Completions.CompletionSourceFuse {
page => new BmarkCompletionOption(option + page.url, page),
)
- this.updateChain()
+ return this.updateChain()
}
updateChain() {
@@ -75,7 +77,7 @@ export class BmarkCompletionSource extends Completions.CompletionSourceFuse {
this.options.forEach(option => (option.state = "normal"))
// Call concrete class
- this.updateDisplay()
+ return this.updateDisplay()
}
onInput() {}
diff --git a/src/completions/Excmd.ts b/src/completions/Excmd.ts
index 83f89706..620d07c5 100644
--- a/src/completions/Excmd.ts
+++ b/src/completions/Excmd.ts
@@ -13,9 +13,9 @@ class ExcmdCompletionOption extends Completions.CompletionOptionHTML
// Create HTMLElement
this.html = html`
- ${value} |
- ${documentation} |
-
`
+ ${value} |
+ ${documentation} |
+ `
}
}
@@ -35,7 +35,7 @@ export class ExcmdCompletionSource extends Completions.CompletionSourceFuse {
}
async onInput(exstr) {
- await this.updateOptions(exstr)
+ return this.updateOptions(exstr)
}
updateChain(exstr = this.lastExstr, options = this.options) {
@@ -82,7 +82,7 @@ export class ExcmdCompletionSource extends Completions.CompletionSourceFuse {
}
this.options.forEach(o => (o.state = "normal"))
- this.updateChain()
+ return this.updateChain()
}
private scoreOptions(options: ExcmdCompletionOption[]) {
diff --git a/src/completions/FileSystem.ts b/src/completions/FileSystem.ts
index dfeedd55..4f0d5a5e 100644
--- a/src/completions/FileSystem.ts
+++ b/src/completions/FileSystem.ts
@@ -9,9 +9,11 @@ class FileSystemCompletionOption extends Completions.CompletionOptionHTML
constructor(public value: string) {
super()
this.fuseKeys = [value]
- this.html = html`
- ${value} |
-
`
+ this.html = html`
+
+ ${value} |
+
+ `
}
}
@@ -25,7 +27,7 @@ export class FileSystemCompletionSource extends Completions.CompletionSourceFuse
}
public async onInput(exstr) {
- this.filter(exstr)
+ return this.filter(exstr)
}
public async filter(exstr: string) {
@@ -71,6 +73,6 @@ export class FileSystemCompletionSource extends Completions.CompletionSourceFuse
)
this.state = "normal"
- this.updateChain()
+ return this.updateChain()
}
}
diff --git a/src/completions/Guiset.ts b/src/completions/Guiset.ts
index 9b48ba0f..8939eea0 100644
--- a/src/completions/Guiset.ts
+++ b/src/completions/Guiset.ts
@@ -5,16 +5,13 @@ class GuisetCompletionOption extends Completions.CompletionOptionHTML
implements Completions.CompletionOptionFuse {
public fuseKeys = []
- constructor(
- public value: string,
- displayValue: string
- ) {
+ constructor(public value: string, displayValue: string) {
super()
this.fuseKeys.push(value)
this.html = html`
- ${displayValue} |
-
`
+ ${displayValue} |
+ `
}
}
@@ -55,14 +52,20 @@ export class GuisetCompletionSource extends Completions.CompletionSourceFuse {
if (metaRules[ruleName]) {
this.options = this.options.concat(
Object.keys(metaRules[ruleName])
- .filter(s => s.startsWith(subRule))
- .map(s => new GuisetCompletionOption(`${ruleName} ${s}`, s)))
+ .filter(s => s.startsWith(subRule))
+ .map(
+ s => new GuisetCompletionOption(`${ruleName} ${s}`, s),
+ ),
+ )
}
if (potentialRules[ruleName]) {
this.options = this.options.concat(
Object.keys(potentialRules[ruleName].options)
- .filter(s => s.startsWith(subRule))
- .map(s => new GuisetCompletionOption(`${ruleName} ${s}`, s)))
+ .filter(s => s.startsWith(subRule))
+ .map(
+ s => new GuisetCompletionOption(`${ruleName} ${s}`, s),
+ ),
+ )
}
if (this.options.length == 0) {
this.options = Object.keys(metaRules)
@@ -71,7 +74,7 @@ export class GuisetCompletionSource extends Completions.CompletionSourceFuse {
.map(s => new GuisetCompletionOption(s, s))
}
- this.updateChain()
+ return this.updateChain()
}
updateChain() {
@@ -79,10 +82,10 @@ export class GuisetCompletionSource extends Completions.CompletionSourceFuse {
this.options.forEach(option => (option.state = "normal"))
// Call concrete class
- this.updateDisplay()
+ return this.updateDisplay()
}
onInput(arg) {
- this.filter(arg)
+ return this.filter(arg)
}
}
diff --git a/src/completions/Help.ts b/src/completions/Help.ts
index 286779e0..d47a2122 100644
--- a/src/completions/Help.ts
+++ b/src/completions/Help.ts
@@ -13,9 +13,9 @@ class HelpCompletionOption extends Completions.CompletionOptionHTML
super()
this.value = `${flag} ${name}`
this.html = html`
- ${name} |
- ${doc} |
-
`
+ ${name} |
+ ${doc} |
+ `
}
}
@@ -136,7 +136,7 @@ export class HelpCompletionSource extends Completions.CompletionSourceFuse {
this.options = opts.sort((compopt1, compopt2) =>
compopt1.name.localeCompare(compopt2.name),
)
- this.updateChain()
+ return this.updateChain()
}
updateChain() {
@@ -144,7 +144,7 @@ export class HelpCompletionSource extends Completions.CompletionSourceFuse {
this.options.forEach(option => (option.state = "normal"))
// Call concrete class
- this.updateDisplay()
+ return this.updateDisplay()
}
onInput() {}
diff --git a/src/completions/History.ts b/src/completions/History.ts
index ce7a247a..85dd3fa8 100644
--- a/src/completions/History.ts
+++ b/src/completions/History.ts
@@ -20,13 +20,15 @@ class HistoryCompletionOption extends Completions.CompletionOptionHTML
const favIconUrl = Completions.DEFAULT_FAVICON
// const favIconUrl = tab.favIconUrl ? tab.favIconUrl : DEFAULT_FAVICON
this.html = html`
- ${"".padEnd(2)} |
- |
- ${page.title} |
- ${page.url} |
-
`
+ ${"".padEnd(2)} |
+ |
+ ${page.title} |
+
+ ${page.url}
+ |
+ `
}
}
@@ -85,7 +87,7 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
page => new HistoryCompletionOption(options + page.url, page),
)
- this.updateChain()
+ return this.updateChain()
}
updateChain() {
@@ -93,7 +95,7 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
this.options.forEach(option => (option.state = "normal"))
// Call concrete class
- this.updateDisplay()
+ return this.updateDisplay()
}
onInput() {}
diff --git a/src/completions/Preferences.ts b/src/completions/Preferences.ts
index 057b0188..d53ef36c 100644
--- a/src/completions/Preferences.ts
+++ b/src/completions/Preferences.ts
@@ -5,16 +5,13 @@ class PreferenceCompletionOption extends Completions.CompletionOptionHTML
implements Completions.CompletionOptionFuse {
public fuseKeys = []
- constructor(
- public value: string,
- public prefvalue: string
- ) {
+ constructor(public value: string, public prefvalue: string) {
super()
this.fuseKeys.push(value)
this.html = html`
- ${value} |
- ${prefvalue} |
-
`
+ ${value} |
+ ${prefvalue} |
+ `
}
}
@@ -22,11 +19,7 @@ export class PreferenceCompletionSource extends Completions.CompletionSourceFuse
public options: PreferenceCompletionOption[]
constructor(private _parent) {
- super(
- ["setpref"],
- "PreferenceCompletionSource",
- "Preference",
- )
+ super(["setpref"], "PreferenceCompletionSource", "Preference")
this._parent.appendChild(this.node)
}
@@ -50,8 +43,7 @@ export class PreferenceCompletionSource extends Completions.CompletionSourceFuse
this.options = Object.keys(preferences)
.filter(key => key.startsWith(pref))
.map(key => new PreferenceCompletionOption(key, preferences[key]))
- if (this.options.length > 0)
- this.state = "normal"
- this.updateChain()
+ if (this.options.length > 0) this.state = "normal"
+ return this.updateChain()
}
}
diff --git a/src/completions/Rss.ts b/src/completions/Rss.ts
index 10b2ba08..c36d6e2d 100644
--- a/src/completions/Rss.ts
+++ b/src/completions/Rss.ts
@@ -12,10 +12,12 @@ class RssCompletionOption extends Completions.CompletionOptionHTML
this.fuseKeys.push(title)
this.html = html``
+ ${title} |
+
+ ${url}
+ |
+ ${type} |
+ `
}
}
@@ -64,6 +66,6 @@ export class RssCompletionSource extends Completions.CompletionSourceFuse {
return opt
})
}
- this.updateChain()
+ return this.updateChain()
}
}
diff --git a/src/completions/Settings.ts b/src/completions/Settings.ts
index 542eb3a4..11e4fe94 100644
--- a/src/completions/Settings.ts
+++ b/src/completions/Settings.ts
@@ -13,11 +13,11 @@ class SettingsCompletionOption extends Completions.CompletionOptionHTML
) {
super()
this.html = html`
- ${setting.name} |
- ${setting.value} |
- ${setting.type} |
- ${setting.doc} |
-
`
+ ${setting.name} |
+ ${setting.value} |
+ ${setting.type} |
+ ${setting.doc} |
+ `
}
}
@@ -62,9 +62,11 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
options += options ? " " : ""
let file, default_config, settings
- if (!(file = metadata.everything.getFile("src/lib/config.ts"))
- || !(default_config = file.getClass("default_config"))
- || !(settings = config.get()))
+ if (
+ !(file = metadata.everything.getFile("src/lib/config.ts")) ||
+ !(default_config = file.getClass("default_config")) ||
+ !(settings = config.get())
+ )
return
this.options = Object.keys(settings)
@@ -74,7 +76,7 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
let md = undefined
let doc = ""
let type = ""
- if (md = default_config.getMember(setting)) {
+ if ((md = default_config.getMember(setting))) {
doc = md.doc
type = md.type.toString()
}
@@ -86,7 +88,7 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
})
})
- this.updateChain()
+ return this.updateChain()
}
updateChain() {
@@ -94,7 +96,7 @@ export class SettingsCompletionSource extends Completions.CompletionSourceFuse {
this.options.forEach(option => (option.state = "normal"))
// Call concrete class
- this.updateDisplay()
+ return this.updateDisplay()
}
onInput() {}
diff --git a/src/completions/Tab.ts b/src/completions/Tab.ts
index 68517a54..8069b3a6 100644
--- a/src/completions/Tab.ts
+++ b/src/completions/Tab.ts
@@ -35,17 +35,18 @@ class BufferCompletionOption extends Completions.CompletionOptionHTML
const favIconUrl = tab.favIconUrl
? tab.favIconUrl
: Completions.DEFAULT_FAVICON
- this.html = html`
- ${pre.padEnd(2)} |
- |
-  |
- ${tab.index + 1}: ${tab.title} |
- ${tab.url} |
-
`
+ this.html = html`
+ ${pre.padEnd(2)} |
+ |
+  |
+ ${tab.index + 1}: ${tab.title} |
+
+ ${tab.url}
+ |
+
`
}
}
@@ -122,18 +123,18 @@ export class BufferCompletionSource extends Completions.CompletionSourceFuse {
} else {
this.options.forEach(option => (option.state = "normal"))
}
- this.updateDisplay()
+ return this.updateDisplay()
}
async onInput(exstr) {
// Schedule an update, if you like. Not very useful for tabs, but
// will be for other things.
- this.updateOptions(exstr)
+ return this.updateOptions(exstr)
}
async filter(exstr) {
this.lastExstr = exstr
- await this.onInput(exstr)
+ return this.onInput(exstr)
}
setStateFromScore(scoredOpts: Completions.ScoredOption[]) {
diff --git a/src/completions/TabAll.ts b/src/completions/TabAll.ts
index 025636f6..6dd95d31 100644
--- a/src/completions/TabAll.ts
+++ b/src/completions/TabAll.ts
@@ -22,20 +22,21 @@ class TabAllCompletionOption extends Completions.CompletionOptionHTML
const favIconUrl = tab.favIconUrl
? tab.favIconUrl
: Completions.DEFAULT_FAVICON
- this.html = html`
- |
- |
- |
-  |
- ${this.value}: ${tab.title} |
- ${tab.url} |
-
`
+ this.html = html`
+ |
+ |
+ |
+  |
+ ${this.value}: ${tab.title} |
+
+ ${tab.url}
+ |
+
`
}
}
@@ -50,7 +51,7 @@ export class TabAllCompletionSource extends Completions.CompletionSourceFuse {
}
async onInput(exstr) {
- await this.updateOptions(exstr)
+ return this.updateOptions(exstr)
}
/**
@@ -112,7 +113,7 @@ export class TabAllCompletionSource extends Completions.CompletionSourceFuse {
this.completion = undefined
this.options = options
- this.updateChain()
+ return this.updateChain()
}
setStateFromScore(scoredOpts: Completions.ScoredOption[]) {