Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Items a copy is still writing are marked in the list

gelenmedyab5f7da15e8a9
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index 50c425a7..fc9d2fa8 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -6113,6 +6113,8 @@ impl FolderView {
fn render_rows(&mut self, range: std::ops::Range<usize>, window: &mut Window, cx: &mut Context<Self>) -> Vec<AnyElement> {
let p = Palette::for_window(window);
+ // the items a copy or a move is still writing here (a folder copied in shows up before its files are all in)
+ let arriving = self.location().path().map(crate::status_center::arriving_names_in).unwrap_or_default();
let list_text = crate::settings::list_text_px(window);
let search_mode = self.is_search();
let prefs = cx.global::<crate::settings::Settings>();
@@ -6375,16 +6377,36 @@ impl FolderView {
.on_mouse_down_out(cx.listener(|this, _: &MouseDownEvent, window, cx| this.commit_rename_if_open(window, cx)))
.child(crate::text_menu::input(&inp).appearance(false).small().px_0())
.into_any_element(),
- None => div()
- .min_w_0()
- .flex_shrink(1.)
- .overflow_hidden()
- .whitespace_nowrap()
- .text_ellipsis()
- .when(dim, |d| d.opacity(0.6))
- .on_mouse_down(MouseButton::Left, cx.listener(|this, _: &MouseDownEvent, _, _| this.name_hit = true))
- .child(name)
- .into_any_element(),
+ None => {
+ let plain = div()
+ .min_w_0()
+ .flex_shrink(1.)
+ .overflow_hidden()
+ .whitespace_nowrap()
+ .text_ellipsis()
+ .when(dim, |d| d.opacity(0.6))
+ .on_mouse_down(MouseButton::Left, cx.listener(|this, _: &MouseDownEvent, _, _| this.name_hit = true))
+ .child(name);
+ if arriving.iter().any(|n| n.eq_ignore_ascii_case(&e.name)) {
+ // still being written into: an arrow that breathes beside the name, until the transfer is over
+ h_flex()
+ .min_w_0()
+ .flex_shrink(1.)
+ .gap_1p5()
+ .items_center()
+ .child(plain)
+ .child(
+ Icon::new(L::ArrowDownToLine).size(px(14.)).text_color(p.accent).flex_shrink_0().with_animation(
+ ("arriving", vi),
+ Animation::new(std::time::Duration::from_millis(1200)).repeat(),
+ |icon, t| icon.opacity(0.35 + 0.65 * (1. - (2. * t - 1.).abs())),
+ ),
+ )
+ .into_any_element()
+ } else {
+ plain.into_any_element()
+ }
+ }
};
let row = h_flex()
.id(("row", vi))
diff --git a/crates/rf-app/src/status_center.rs b/crates/rf-app/src/status_center.rs
index a6f0a226..a7a3961b 100644
--- a/crates/rf-app/src/status_center.rs
+++ b/crates/rf-app/src/status_center.rs
@@ -937,31 +937,46 @@ fn paste_virtual_as(cx: &mut App, dest: std::path::PathBuf, clash: rf_win::vfile
}
/// `record = false` for undo/redo replays (they must not land on the undo stack again).
-/// The folders copies and moves are writing into right now, with when each began (see [`still_arriving`]).
-static ARRIVING: std::sync::Mutex<Vec<(u64, std::path::PathBuf, std::time::SystemTime)>> = std::sync::Mutex::new(Vec::new());
+/// The folders copies and moves are writing into right now, with when each began (see [`still_arriving`]) and the names of the
+/// items they bring (see [`arriving_names_in`]).
+#[allow(clippy::type_complexity)]
+static ARRIVING: std::sync::Mutex<Vec<(u64, std::path::PathBuf, std::time::SystemTime, Vec<String>)>> = std::sync::Mutex::new(Vec::new());
static ARRIVING_NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);
/// Holds a destination in [`ARRIVING`] for as long as its transfer runs.
struct Arriving(u64);
impl Arriving {
fn begin(dest: &std::path::Path) -> Self {
+ Self::bringing(dest, &[])
+ }
+
+ /// [`Arriving::begin`] for a transfer of `sources`: the items named as they are arrive in `dest`.
+ fn bringing(dest: &std::path::Path, sources: &[std::path::PathBuf]) -> Self {
let id = ARRIVING_NEXT.fetch_add(1, Ordering::Relaxed);
- ARRIVING.lock().unwrap().push((id, dest.to_path_buf(), std::time::SystemTime::now()));
+ let names = sources.iter().filter_map(|s| s.file_name().map(|n| n.to_string_lossy().into_owned())).collect();
+ ARRIVING.lock().unwrap().push((id, dest.to_path_buf(), std::time::SystemTime::now(), names));
Arriving(id)
}
}
impl Drop for Arriving {
fn drop(&mut self) {
- ARRIVING.lock().unwrap().retain(|(id, _, _)| *id != self.0);
+ ARRIVING.lock().unwrap().retain(|(id, _, _, _)| *id != self.0);
}
}
+/// The names of the items copies and moves are writing into `dir` right now (a folder copied in is listed while its files still
+/// arrive): the list marks them (Discord, 2026-12-01: "mark a folder that's still being copied into"). Empty, without a lock held
+/// long, when nothing is being written there.
+pub fn arriving_names_in(dir: &std::path::Path) -> Vec<String> {
+ ARRIVING.lock().unwrap().iter().filter(|(_, d, _, _)| d.as_path() == dir).flat_map(|(_, _, _, n)| n.iter().cloned()).collect()
+}
+
/// Whether `item` is still being written by a copy or move that runs now: it sits directly in that transfer's destination and was
/// made after the transfer began. Renaming it then would leave the transfer writing under the old name, which it makes again
/// (issue 297: "x - Copy" came back with the files going on into it).
pub fn still_arriving(item: &std::path::Path) -> bool {
let Some(parent) = item.parent() else { return false };
- let jobs: Vec<std::time::SystemTime> = ARRIVING.lock().unwrap().iter().filter(|(_, d, _)| d.as_path() == parent).map(|(_, _, t)| *t).collect();
+ let jobs: Vec<std::time::SystemTime> = ARRIVING.lock().unwrap().iter().filter(|(_, d, _, _)| d.as_path() == parent).map(|(_, _, t, _)| *t).collect();
if jobs.is_empty() {
return false;
}
@@ -1035,6 +1050,8 @@ fn transfer_inner(
f(std::mem::take(&mut *arrived.lock().unwrap()), cx);
}
reread(cx);
+ // (the lists drop their "still arriving" marks: see `arriving_names_in`)
+ cx.refresh_windows();
});
// the strip's sentence, what the finished card opens, and the mark that tells its "Geri al" which undo record is its own
let words = match kind {
@@ -1048,7 +1065,7 @@ fn transfer_inner(
let marker = mark.clone();
let listed = sources.clone();
let id = start_with_id(cx, title, move |t| {
- let _arriving = Arriving::begin(&dest);
+ let _arriving = Arriving::bringing(&dest, &sources);
noted.note(kind, &sources, &dest);
t.set_verify(verify);
t.limit.store(limit, Ordering::Relaxed);