mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Fix #4605: allow autocmddelete on default autocmds
This commit is contained in:
parent
b487a712bd
commit
14c7d77cd2
|
|
@ -4941,7 +4941,7 @@ export function autocmddelete(event: string, url: string) {
|
|||
if (webrequests.requestEvents.includes(event)) {
|
||||
webrequests.unregisterWebRequestAutocmd(event, url)
|
||||
}
|
||||
return config.unset("autocmds", event, url)
|
||||
return config.set("autocmds", event, url, null)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,6 +66,18 @@ test("keymap unbind default", () => {
|
|||
expect(exmaps["<Space>"]).toBeUndefined()
|
||||
})
|
||||
|
||||
test("null removes and exports a default autocmd", async () => {
|
||||
const event = "DocLoad"
|
||||
const url = "^https://github.com/tridactyl/tridactyl/issues/new$"
|
||||
|
||||
expect(get("autocmds", event)[url]).toBe("issue")
|
||||
await tri.config.set("autocmds", event, url, null)
|
||||
|
||||
expect(tri.config.USERCONFIG.autocmds[event][url]).toBeNull()
|
||||
expect(get("autocmds", event)[url]).toBeUndefined()
|
||||
expect(tri.config.parseConfig()).toContain(`autocmddelete ${event} ${url}`)
|
||||
})
|
||||
|
||||
test("get in modified inherit keymap", () => {
|
||||
expect(config["vmaps"]["🕷🕷INHERITS🕷🕷"]).toBe("nmaps")
|
||||
expect("q" in config["vmaps"]).toBe(true)
|
||||
|
|
|
|||
|
|
@ -2635,8 +2635,11 @@ const parseConfigHelper = (pconf, parseobj, prefix = []) => {
|
|||
}
|
||||
} else if (i === "autocmds") {
|
||||
for (const a of Object.keys(pconf[i][e])) {
|
||||
const value = pconf[i][e][a]
|
||||
parseobj.aucmds.push(
|
||||
`autocmd ${e} ${a} ${pconf[i][e][a]}`,
|
||||
value === null
|
||||
? `autocmddelete ${e} ${a}`
|
||||
: `autocmd ${e} ${a} ${value}`,
|
||||
)
|
||||
}
|
||||
} else if (i === "autocontain") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue