fix: sync browsing when entering a directory from filtered/fuzzy view

Closes #382
This commit is contained in:
Christian Visintin
2026-03-21 11:24:41 +01:00
parent 024f156fc8
commit 0c94a68047
3 changed files with 15 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ use remotefs::File;
use super::{FileTransferActivity, LogLevel, Msg, PendingActionMsg};
/// Describes destination for sync browsing
enum SyncBrowsingDestination {
pub(crate) enum SyncBrowsingDestination {
Path(String),
ParentDir,
PreviousDir,
@@ -63,7 +63,7 @@ impl FileTransferActivity {
/// Synchronize browsing on the target browser.
/// If destination doesn't exist, then prompt for directory creation.
fn synchronize_browsing(&mut self, destination: SyncBrowsingDestination) {
pub(crate) fn synchronize_browsing(&mut self, destination: SyncBrowsingDestination) {
// Get destination path
let path = match self.resolve_sync_browsing_destination(&destination) {
Some(p) => p,

View File

@@ -5,6 +5,7 @@
// locals
use std::path::PathBuf;
use super::change_dir::SyncBrowsingDestination;
use super::{File, FileTransferActivity, LogLevel, SelectedFile, TransferOpts, TransferPayload};
impl FileTransferActivity {
@@ -23,6 +24,14 @@ impl FileTransferActivity {
};
// Change directory on the active tab's pane
self.pane_changedir(path.as_path(), true);
// Sync browsing: mirror the directory change on the opposite pane
if self.browser.sync_browsing {
let dir_name = path
.file_name()
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_default();
self.synchronize_browsing(SyncBrowsingDestination::Path(dir_name));
}
}
}

View File

@@ -120,7 +120,10 @@ impl FileTransferActivity {
self.umount_find();
// Finalize find
self.finalize_find();
// Reload files
// Reload files; update opposite pane too when sync browsing
if self.browser.sync_browsing {
self.update_browser_file_list_swapped();
}
self.update_browser_file_list()
}
TransferMsg::ExecuteCmd(cmd) => {