From 03a062bc14dfad8b66ba580453a472a7a52ec494 Mon Sep 17 00:00:00 2001 From: gdh1995 Date: Thu, 3 Feb 2022 23:31:26 +0800 Subject: [PATCH] fix alt-enter on Vomnibar --- front/vomnibar.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/front/vomnibar.ts b/front/vomnibar.ts index 06ec6b8fb..25871fec0 100644 --- a/front/vomnibar.ts +++ b/front/vomnibar.ts @@ -817,16 +817,18 @@ var VCID_: string | undefined = VCID_ || "", VHost_: string | undefined = VHost_ navReq: Req.fg | null = item.s != null ? null : { H: kFgReq.openUrl, f: false, r: action, h: sel >= 0 ? null : https, u: item.u, o: { i: incognito, s: sel >= 0 ? { r: false, k: "" } : a.sed_, p: a.position_, t: noTest ? false : "whole" } + }, sessionReq: Req.fg | null = item.s == null ? null : { H: kFgReq.gotoSession, + a: action > ReuseType.newBg, s: item.s }, func = function (this: void): void { - !VPort_ ? 0 : item.s != null ? Vomnibar_.gotoSession_(item as SuggestionE & Ensure, action) - : Vomnibar_.navigateToUrl_(navReq!, action); + !VPort_ ? 0 : navReq ? Vomnibar_.navigateToUrl_(navReq, action) + : Vomnibar_.gotoSession_(sessionReq!, (item as SuggestionE).e === "tab"); ( /a?/).test(""); }; if (sel === -1 && event && event !== !0 && event & KeyStat.altKey && action > ReuseType.newBg && ( /^\w+(-\w+)?$/).test(item.u)) { const domains = a.completions_.filter(i => i.e === "domain"); - (item as UrlInfo).u = domains.length ? domains[0].u : `www.${item.u}.com`; + navReq!.u = domains.length ? domains[0].u : `www.${item.u}.com` } if (action > ReuseType.newBg || event && event !== !0 && event & KeyStat.altKey) { a.doEnter_ = [func, action] @@ -1458,9 +1460,9 @@ var VCID_: string | undefined = VCID_ || "", VHost_: string | undefined = VHost_ return Vomnibar_.refresh_(); } }, - gotoSession_ (item: SuggestionE & Ensure, reuse: ReuseType): void { - VPort_.post_({ H: kFgReq.gotoSession, a: reuse > ReuseType.newBg, s: item.s }) - Vomnibar_ && Vomnibar_.isActive_ && Vomnibar_.refresh_(item.e === "tab") + gotoSession_ (req: Req.fg, isTab: boolean): void { + VPort_.post_(req) + Vomnibar_ && Vomnibar_.isActive_ && Vomnibar_.refresh_(isTab) }, refresh_ (waitFocus?: boolean): void { getSelection().removeAllRanges();