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

Closes #382
This commit is contained in:
Christian Visintin
2026-04-19 01:54:46 +05:30
parent bd0843d3da
commit 0025b87b0f
3 changed files with 15 additions and 3 deletions
@@ -10,7 +10,7 @@ use remotefs::File;
use super::{FileTransferActivity, LogLevel, Msg, PendingActionMsg}; use super::{FileTransferActivity, LogLevel, Msg, PendingActionMsg};
/// Describes destination for sync browsing /// Describes destination for sync browsing
enum SyncBrowsingDestination { pub(crate) enum SyncBrowsingDestination {
Path(String), Path(String),
ParentDir, ParentDir,
PreviousDir, PreviousDir,
@@ -63,7 +63,7 @@ impl FileTransferActivity {
/// Synchronize browsing on the target browser. /// Synchronize browsing on the target browser.
/// If destination doesn't exist, then prompt for directory creation. /// 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 // Get destination path
let path = match self.resolve_sync_browsing_destination(&destination) { let path = match self.resolve_sync_browsing_destination(&destination) {
Some(p) => p, Some(p) => p,
@@ -5,6 +5,7 @@
// locals // locals
use std::path::PathBuf; use std::path::PathBuf;
use super::change_dir::SyncBrowsingDestination;
use super::{File, FileTransferActivity, LogLevel, SelectedFile, TransferOpts, TransferPayload}; use super::{File, FileTransferActivity, LogLevel, SelectedFile, TransferOpts, TransferPayload};
impl FileTransferActivity { impl FileTransferActivity {
@@ -23,6 +24,14 @@ impl FileTransferActivity {
}; };
// Change directory on the active tab's pane // Change directory on the active tab's pane
self.pane_changedir(path.as_path(), true); 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));
}
} }
} }
+4 -1
View File
@@ -120,7 +120,10 @@ impl FileTransferActivity {
self.umount_find(); self.umount_find();
// Finalize find // Finalize find
self.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() self.update_browser_file_list()
} }
TransferMsg::ExecuteCmd(cmd) => { TransferMsg::ExecuteCmd(cmd) => {