Make find settings use the new typed configurations

This commit is contained in:
Oliver Blanthorn 2019-01-15 17:27:08 +00:00
parent 6992eb5699
commit c545c42514
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 8 additions and 8 deletions

View file

@ -60,11 +60,11 @@ export class FindCompletionSource extends Completions.CompletionSourceFuse {
}
let query = tokens.slice(1).join(" ")
let minincsearchlen = parseInt(await config.getAsync("minincsearchlen"))
let minincsearchlen = await config.getAsync("minincsearchlen")
// No point if continuing if the user hasn't started searching yet
if (query.length < minincsearchlen) return
let findresults = parseInt(await config.getAsync("findresults"))
let findresults = await config.getAsync("findresults")
let incsearch = (await config.getAsync("incsearch")) === "true"
if (findresults === 0 && !incsearch) return
@ -87,7 +87,7 @@ export class FindCompletionSource extends Completions.CompletionSourceFuse {
// If the search was successful
if (findings.length > 0) {
// Get match context
let len = parseInt(await config.getAsync("findcontextlen"))
let len = await config.getAsync("findcontextlen")
let matches = await Messaging.messageTab(
tabId,
"finding_content",

View file

@ -779,27 +779,27 @@ class default_config {
/**
* Number of results that should be shown in completions. -1 for unlimited
*/
findresults: "0"
findresults = -1
/**
* Number of characters to use as context for the matches shown in completions
*/
findcontextlen: "10"
findcontextlen = 10
/**
* Whether find should be case-sensitive
*/
findcase: "smart" // "smart" | "sensitive" | "unsensitive"
findcase: "smart" | "sensitive" | "unsensitive" = "smart"
/**
* Whether Tridactyl should jump to the first match when using `:find`
*/
incsearch: "false"
incsearch: "true" | "false" = "false"
/**
* How many characters should be typed before triggering incsearch/completions
*/
minincsearchlen: "3"
minincsearchlen = 3
/**
* Change this to "clobber" to ruin the "Content Security Policy" of all sites a bit and make Tridactyl run a bit better on some of them, e.g. raw.github*