fix(project): expire stale file clipboard after OS replacement (#598)

Project Paste could reuse an earlier file copy after another app replaced the OS clipboard, and Cut files stayed dimmed. The tree now tracks the hand-off to the OS clipboard and rechecks it on window focus and just before Paste. A local Copy or Cut is cleared once the OS holds a different or empty file list; failed writes and clipboard read errors keep it. The native adapters now distinguish read failures from empty lists.

In remote windows, Copy and Cut write newline-joined server paths as plain text, tree Paste keeps the server source, and a later OS file list replaces the remote copy and imports those client files. A plain-text replacement stays undetectable there without a clipboard read that may prompt.

Verified on macOS, locally and against a remote host. The Windows clipboard code was not run.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-01 08:32:33 +08:00
1 джерело 4395975664
коміт 0458424f9c
8 files changed
+327 -44

No files matched your search

+1 -1
Переглянути файл
@@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
#[tauri::command]
#[specta::specta]
pub async fn clipboard_file_list() -> IdeResult<Vec<String>> {
blocking(|| Ok(ide_clipboard::files().iter().map(|p| slash(p)).collect())).await
blocking(|| Ok(ide_clipboard::files()?.iter().map(|p| slash(p)).collect())).await
}
/// Whether the clipboard holds files: cheap, for the Paste item's enabled state.