diff --git a/background/all_commands.ts b/background/all_commands.ts index 67e06e5bc..abfaa0364 100644 --- a/background/all_commands.ts +++ b/background/all_commands.ts @@ -245,10 +245,10 @@ set_bgC_([ } satisfies { [key in Exclude]: 1 } - for (const [key, val] of Object.entries!(dict)) { - if (key && key[0] !== "$" && !skipped.hasOwnProperty(key)) { - destDict[(dict === opts2 && key.startsWith("o.") ? key.slice(2) : key) as keyof EventInit] = val as any - dict === opts2 && delete (opts2)[key as keyof EventInit] + for (const key of dict === opts2 ? "alt ctrl meta shift super".split(" ") as ("super" | "superKey")[] : []) { + if (key in opts2 && !((key + "Key") in opts2)) { + opts2[(key + "Key") as "superKey"] = opts2[key as "super" as unknown as "superKey"] + delete opts2[key as "superKey"] } } if (opts2.superKey) { @@ -256,6 +256,13 @@ set_bgC_([ ? destDict.metaKey = true : destDict.ctrlKey = true delete opts2.superKey } + for (const [key, val] of Object.entries!(dict)) { + if (key && (dict !== opts2 || key[0] !== "$") && !skipped.hasOwnProperty(key)) { + destDict[(dict === opts2 ? key.startsWith("o.") ? key.slice(2) : key + : key.startsWith("$") ? key.slice(1) : key) as keyof EventInit] = val as any + dict === opts2 && delete (opts2)[key as keyof EventInit] + } + } let nonWordArr: RegExpExecArray | null = null if (key && (typeof key === "object" || typeof key === "string")) { typeof key === "string" && (nonWordArr = ( /[^\w]/).exec(key.slice(1))) diff --git a/content/commands.ts b/content/commands.ts index 9ea7ada48..e363bd3f8 100644 --- a/content/commands.ts +++ b/content/commands.ts @@ -409,6 +409,7 @@ set_contentCommands_([ return cur } })) + cur === 0 && (offset += a1.length, start += offset, end += offset) editable === insert_Lock_() && rawOffset != null && inputSelRange(editable, start, end) } else if (cmd === "select") { const activeEl = findAnElement_(options, i > firstCmd ? 1 : count)[0] diff --git a/content/hud.ts b/content/hud.ts index 4d407e836..ac86c1801 100644 --- a/content/hud.ts +++ b/content/hud.ts @@ -26,7 +26,8 @@ export { box as hud_box, text as hud_text, opacity_ as hud_opacity, timer as hud export const hudTip = (tid: kTip | HintMode, duration?: 0 | 0.0001 | 1 | 2, args?: Array | string , embed?: 1): void => { hudShow(tid, args, embed) - text && (timer = timeout_(hudHide, ((duration || 1.5) * 1000) | 0)) + text && (timer = timeout_(hudHide + , ((duration || (tid === kTip.copiedIs && (find_box || visual_mode_name) ? 0.5 : 1.5)) * 1000) | 0)) } export const hudShow = (tid: kTip | HintMode, args?: Array | string , embed?: boolean | BOOL | TimerType.fake | void): void => {