Solved index of files list no more kept after 0.3.0

This commit is contained in:
ChristianVisintin 2021-01-16 11:16:31 +01:00
parent 9330025d07
commit 03e1bf53d0
2 changed files with 8 additions and 0 deletions

View file

@ -17,6 +17,8 @@ FIXME: Released on ???
- Enhancements:
- Added connection timeout to 30 seconds to SFTP/SCP clients and improved name lookup system.
- Bugfix:
- Solved index in explorer files list which was no more kept after 0.3.0
## 0.3.0

View file

@ -600,7 +600,10 @@ impl FileTransferActivity {
match self.context.as_ref().unwrap().local.scan_dir(path) {
Ok(files) => {
// Set files and sort (sorting is implicit)
let prev_index: usize = self.local.get_index();
self.local.set_files(files);
// Restore index
self.local.set_index(prev_index);
// Set index; keep if possible, otherwise set to last item
self.local.set_index(match self.local.get_current_file() {
Some(_) => self.local.get_index(),
@ -626,7 +629,10 @@ impl FileTransferActivity {
match self.client.list_dir(path) {
Ok(files) => {
// Set files and sort (sorting is implicit)
let prev_index: usize = self.remote.get_index();
self.remote.set_files(files);
// Restore index
self.remote.set_index(prev_index);
// Set index; keep if possible, otherwise set to last item
self.remote.set_index(match self.remote.get_current_file() {
Some(_) => self.remote.get_index(),