From e5c2a8d9cd4dd0cdb33ef0fd14dd3712e3130b09 Mon Sep 17 00:00:00 2001 From: Mariusz Kaczmarczyk Date: Fri, 26 Mar 2021 22:46:28 +0100 Subject: [PATCH] Use messageTab directly in scrolltab and change the function comment --- src/excmds.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/excmds.ts b/src/excmds.ts index cf1ed9a1..3508ef65 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -1158,18 +1158,19 @@ export async function markjumpbefore() { } const currentTabId = await activeTabId() state.beforeJumpMark = { url: window.location.href.split("#")[0], scrollX: window.scrollX, scrollY: window.scrollY, tabId: currentTabId } - goToTab(tabId).then(() => scrolltab(tabId, scrollX, scrollY, "# Jumped to the last location before a mark jump")) + goToTab(tabId).then(() => scrolltab(tabId, scrollX, scrollY, "# Jumped back")) } catch (e) { // the mark's tab is no longer valid } } /** - * Scrolls to a given position in a given tab and prints a message in it. + * Scrolls to a given position in a tab identified by tabId and prints a message in it. */ //#content export async function scrolltab(tabId: number, scrollX: number, scrollY: number, message: string) { - acceptExCmd(tabId, [`composite scrollto ${scrollX} ${scrollY}; fillcmdline_tmp 3000 ${message}`]) + await Messaging.messageTab(tabId, "controller_content", "acceptExCmd", [`composite scrollto ${scrollX} ${scrollY}`]) + Messaging.messageTab(tabId, "controller_content", "acceptExCmd", [`fillcmdline_tmp 3000 ${message}`]) } /** @@ -4928,17 +4929,6 @@ export function jumble() { } } -/** - * Run a command in a tab with an internal firefox identifier specified by destination or in background if destination is "background". - */ -//#content -export function acceptExCmd(destination: number | "background", ex_string: string[]) { - if (destination === "background") { - return run_exstr(...ex_string) - } - return Messaging.messageTab(destination, "controller_content", "acceptExCmd", ex_string) -} - /** * Hacky ex string parser. *