Solved index of files list no more kept after 0.3.0 (use set_abs_index instead)

This commit is contained in:
ChristianVisintin
2021-01-16 11:35:33 +01:00
parent 03e1bf53d0
commit 928fc1b450
2 changed files with 44 additions and 4 deletions

View File

@@ -603,9 +603,9 @@ impl FileTransferActivity {
let prev_index: usize = self.local.get_index();
self.local.set_files(files);
// Restore index
self.local.set_index(prev_index);
self.local.set_abs_index(prev_index);
// Set index; keep if possible, otherwise set to last item
self.local.set_index(match self.local.get_current_file() {
self.local.set_abs_index(match self.local.get_current_file() {
Some(_) => self.local.get_index(),
None => match self.local.count() {
0 => 0,
@@ -632,9 +632,9 @@ impl FileTransferActivity {
let prev_index: usize = self.remote.get_index();
self.remote.set_files(files);
// Restore index
self.remote.set_index(prev_index);
self.remote.set_abs_index(prev_index);
// Set index; keep if possible, otherwise set to last item
self.remote.set_index(match self.remote.get_current_file() {
self.remote.set_abs_index(match self.remote.get_current_file() {
Some(_) => self.remote.get_index(),
None => match self.remote.count() {
0 => 0,