mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Fix #850: Dodgy yy
I don't quite understand how it worked at all without focusing the commandline first. Peppered code with some more awaits as part of debugging and couldn't be bothered to test which were necessary.
This commit is contained in:
parent
c3d0ef60c8
commit
756c29673a
2 changed files with 7 additions and 4 deletions
|
@ -336,7 +336,7 @@ function applyWithTmpTextArea(fn) {
|
|||
}
|
||||
}
|
||||
|
||||
export function setClipboard(content: string) {
|
||||
export async function setClipboard(content: string) {
|
||||
applyWithTmpTextArea(scratchpad => {
|
||||
scratchpad.value = content
|
||||
scratchpad.select()
|
||||
|
@ -346,7 +346,7 @@ export function setClipboard(content: string) {
|
|||
} else throw "Failed to copy!"
|
||||
})
|
||||
// Return focus to the document
|
||||
Messaging.message("commandline_background", "hide")
|
||||
await Messaging.message("commandline_background", "hide")
|
||||
}
|
||||
|
||||
export function getClipboard() {
|
||||
|
|
|
@ -2192,7 +2192,10 @@ export async function yank(...content: string[]) {
|
|||
async function setclip(str) {
|
||||
// Functions to avoid retyping everything everywhere
|
||||
let s = () => Native.clipboard("set", str)
|
||||
let c = () => messageActiveTab("commandline_frame", "setClipboard", [str])
|
||||
let c = async () => {
|
||||
await messageActiveTab("commandline_content", "focus")
|
||||
await messageActiveTab("commandline_frame", "setClipboard", [str])
|
||||
}
|
||||
|
||||
let promises = []
|
||||
switch (await config.getAsync("yankto")) {
|
||||
|
@ -2206,7 +2209,7 @@ async function setclip(str) {
|
|||
promises = [s(), c()]
|
||||
break
|
||||
}
|
||||
return Promise.all(promises)
|
||||
return await Promise.all(promises)
|
||||
}
|
||||
|
||||
/** Fetches the content of the clipboard/selection buffer depending on user's preferences
|
||||
|
|
Loading…
Add table
Reference in a new issue