feat(browser): add a Tree view mode and align view names with Finder - #321
spandan11106 wants to merge 3 commits into
Conversation
The view switcher named the Miller columns "List", the icon grid "Grid" and the table "Explorer", which is not what those views are called anywhere else. Rename the labels to Columns, Icons and List; the `BrowserMode` variants keep their names so the change stays user-facing. Add a fourth presentation, Tree: one vertical pane whose folders expand in place, indented by depth. Its root level mirrors the browser's active column, so selection, renames, the item menu and drag and drop keep working there. Rows inside an expanded branch belong to directories the navigation state does not own, so the view loads them through `Browser::list_directory` and orders them with `Browser::sorted_entries`, keeping listing budgets, sort order and the hidden-file rule in the application layer. Branches are dropped when the pane's column reloads, so a sort or hidden-file change never leaves a stale listing behind.
|
@spandan11106, keyboard navigation crashes the changes here. Please fix. |
Pressing Enter, Right or l in the tree aborted the process. `activate_focused` held a shared borrow of the mode views while the tree called `Browser::activate_in_place`, which emits synchronously; the observer then took a mutable borrow of the same cell and panicked with "RefCell already borrowed" inside a GTK callback, which cannot unwind. The tree now reports what activating a row should do instead of doing it, so the caller releases its borrow before the browser runs and emits.
|
Fixed in 4cc8bb1. Root cause: The tree now returns what activating a row should do ( Verified by driving |

Description
The view switcher named the Miller columns "List", the icon grid "Grid" and the table "Explorer", none of which is what those views are called elsewhere. The labels are now Columns, Icons and List. The
BrowserModevariants keep their names, so this is a user-facing rename only.Adds a fourth presentation, Tree: one vertical pane whose folders expand in place with a disclosure chevron, indented by depth. Its root level mirrors the browser's active column, so selection, inline rename, the item context menu, cut styling and drag and drop behave exactly as they do in List. Rows inside an expanded branch belong to directories the navigation state does not own, so the view lists them through
Browser::list_directoryand orders them withBrowser::sorted_entries— listing budgets, sort order and the hidden-file rule stay in the application layer. Every branch is dropped when the pane's column reloads, so changing the sort or toggling hidden files never leaves a stale listing behind.Keyboard: →/l expands the focused folder (and activates it when there is nothing to expand), ←/h collapses it, then walks to the parent row, then leaves the directory. ↑/↓ and k/j move through the flattened tree rather than skipping expanded children.
Known limits, both because a row below the root level has no position in the browser's active column: rows inside an expanded branch are not part of the multi-selection the rest of the app acts on, and right-clicking one shows the folder menu rather than the item menu. Clicking, expanding, opening and quick preview all work on them. Worth a follow-up once selection can address entries by location.
Visual evidence
Tree mode, collapsed:
Tree mode, with
alphaandalpha/nestedexpanded:How to test
cargo run -- ~/Projects.Expected result: folders expand and collapse in place with their children indented one level further and sorted with folders first; arrow keys expand, collapse and move through the flattened tree; hidden files appear and disappear at every level, and a sort change reorders expanded branches too; Strata reopens in Tree mode. Switching to Columns, Icons and List still works as before.
Related issue
Closes #315