fix windows paste bug.
This commit is contained in:
parent
0805442bf2
commit
ad3ca2c0c6
1 changed files with 8 additions and 0 deletions
|
|
@ -54,8 +54,16 @@ pub fn paste(text: String, app_handle: AppHandle) -> Result<(), String> {
|
|||
.write_text(&text)
|
||||
.map_err(|e| format!("Failed to write to clipboard: {}", e))?;
|
||||
|
||||
// Add a small delay on Windows to ensure clipboard write is complete
|
||||
#[cfg(target_os = "windows")]
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
|
||||
send_paste()?;
|
||||
|
||||
// Add another small delay before restoring clipboard
|
||||
#[cfg(target_os = "windows")]
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
|
||||
// restore the clipboard
|
||||
clipboard
|
||||
.write_text(&clipboard_content)
|
||||
|
|
|
|||
Loading…
Reference in a new issue