From e0763a9d9ac07f33ce9beb4774c6ed00ece97fb8 Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Wed, 5 Aug 2020 17:40:20 +0100 Subject: [PATCH] Fix #2707: make :help take you to right page --- src/excmds.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/excmds.ts b/src/excmds.ts index 31664a44..f2f244af 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -1435,18 +1435,21 @@ export async function help(...helpItems: string[]) { const subject = helpItems.join(" ") const settings = await config.getAsync() let url = "" + if (subject === "") { + url = browser.runtime.getURL("static/docs/modules/_src_excmds_.html") + } else { + // If the user did specify what they wanted, specifically look for it + if (flag !== "") { + url = flags[flag](settings, subject) + } - // If the user did specify what they wanted, specifically look for it - if (flag !== "") { - url = flags[flag](settings, subject) - } - - // Otherwise or if it couldn't be found, try all possible items - if (url === "") { - url = ["-b", "-s", "-a", "-e"].reduce((acc, curFlag) => { - if (acc !== "") return acc - return flags[curFlag](settings, subject) - }, "") + // Otherwise or if it couldn't be found, try all possible items + if (url === "") { + url = ["-b", "-s", "-a", "-e"].reduce((acc, curFlag) => { + if (acc !== "") return acc + return flags[curFlag](settings, subject) + }, "") + } } let done