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.

Columns view: clicking empty area activates that column (issue 857)

Marcos Gramelich872f52dfb877
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index 4d02225c..3a5b802b 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -897,6 +897,8 @@ pub struct FolderView {
col_carry: Option<Pixels>,
/// Back or Up into a folder with nothing to select in it: the folder and where its list stood, applied once it is listed.
place_back: Option<(PathBuf, Pixels)>,
+ /// Folder activated in Column view by clicking its empty space: skip the automatic selection of item 0 once it loads (issue 857).
+ col_no_autoselect: Option<PathBuf>,
/// Where the list stood in the folders left lately (a Discord report, 2026-11-28: "When you navigate back up from a subfolder ...
/// the window does not return to the folder; instead, it jumps to the bottom or to the top"). Back and Up give it back to the
/// folder they return to (`col_carry`), so the list is where it was, with the folder one came out of selected in it.
@@ -1159,6 +1161,7 @@ impl FolderView {
col_pick: None,
col_carry: None,
place_back: None,
+ col_no_autoselect: None,
scroll_memory: Vec::new(),
center_reselect: false,
first_click: None,
@@ -2701,9 +2704,13 @@ impl FolderView {
base.set_offset(o);
}
// in the columns layout a folder is entered on its first item, as in yazi (issue 51: "When entering a folder, you first have
- // to press down on the arrow keys to focus on the top entry"): Right goes on into it at once
- if self.view_mode == ViewMode::Columns && self.cursor.is_none() && self.reselect.is_none() && !self.loading && !self.visible.is_empty() {
- self.select_only(0);
+ // to press down on the arrow keys to focus on the top entry"): Right goes on into it at once.
+ // Skipped when the folder was activated by clicking its empty space (issue 857).
+ if self.view_mode == ViewMode::Columns && self.cursor.is_none() && self.reselect.is_none() && !self.loading {
+ let skip = self.col_no_autoselect.take().is_some_and(|d| self.location().path() == Some(d.as_path()));
+ if !skip && !self.visible.is_empty() {
+ self.select_only(0);
+ }
}
let _ = cx;
}
@@ -4608,15 +4615,21 @@ impl FolderView {
}
}
- /// A press on the empty space of a column beside the list's own. It does not clear the selection (issue 140: the column of the
- /// selected folder went away under the pointer); a double click there goes up, as one in the list's own column does (Settings →
- /// "Double-click an empty area to go up"; issue 318: it did so in one column only).
- fn column_empty_press(&mut self, ev: &MouseDownEvent, cx: &mut Context<Self>) {
+ /// A press on the empty space of a column beside the list's own. A single click activates that column's folder immediately
+ /// without auto-selecting its first item (issue 857), keeping its scroll position and without letting the press fall through
+ /// to clear the previous column's selection (issue 140); a double click there goes up, as one in the list's own column does
+ /// (Settings → "Double-click an empty area to go up"; issue 318).
+ fn column_empty_press(&mut self, dir: PathBuf, ev: &MouseDownEvent, window: &mut Window, cx: &mut Context<Self>) {
+ window.focus(&self.focus, cx);
let second = is_second_click(ev.click_count);
let double = second && completes_double(self.first_click.as_ref(), self.load_serial, None);
self.first_click = (!second).then(|| FirstClick { load: self.load_serial, name: None });
if !second {
self.col_pick = None;
+ self.clear_reselect();
+ self.place_back = self.col_scrolls.get(&dir).map(|h| (dir.clone(), h.0.borrow().base_handle.offset().y));
+ self.col_no_autoselect = Some(dir.clone());
+ self.navigate(Location::Path(dir), cx);
} else if !double {
self.finish_col_pick(cx);
} else if cx.global::<crate::settings::Settings>().double_click_up {
@@ -7788,6 +7801,7 @@ fn static_column(
view: Entity<FolderView>,
) -> impl IntoElement {
let empty_view = view.clone();
+ let empty_dir = dir.clone();
let has_rows = list.as_ref().is_some_and(|l| !l.is_empty());
// (a scrollbar's own id per column: the column's id carries a number or a name)
let bar_key = {
@@ -7888,9 +7902,9 @@ fn static_column(
.border_color(p.divider)
// a press on the column's empty space is not the list's: the list's background took it as a click on nothing, cleared the
// selection, and the column of the selected folder went away under the pointer (issue 140)
- .on_mouse_down(MouseButton::Left, move |ev, _, cx| {
+ .on_mouse_down(MouseButton::Left, move |ev, window, cx| {
cx.stop_propagation();
- empty_view.update(cx, |v, cx| v.column_empty_press(ev, cx));
+ empty_view.update(cx, |v, cx| v.column_empty_press(empty_dir.clone(), ev, window, cx));
})
.on_mouse_down(MouseButton::Right, |_, _, cx| cx.stop_propagation())
// the same thin scrollbar as the other layouts (issue 560: "add scroll bar on the column view list")