From a242834bffcea459932d5c8269120fb6bb3a584a Mon Sep 17 00:00:00 2001 From: edouardparis Date: Thu, 24 Jul 2025 09:38:27 +0200 Subject: [PATCH 1/2] fix: missing closing tabs with wallet loading --- liana-gui/src/gui/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/liana-gui/src/gui/mod.rs b/liana-gui/src/gui/mod.rs index f64ea2dc..9b8a35aa 100644 --- a/liana-gui/src/gui/mod.rs +++ b/liana-gui/src/gui/mod.rs @@ -239,12 +239,14 @@ impl GUI { .iter() .enumerate() .filter_map(|(i, tab)| { - if let tab::State::App(a) = &tab.state { - if a.wallet_id() == *wallet_id { - Some(i) - } else { - None + if match &tab.state { + tab::State::App(a) => a.wallet_id() == *wallet_id, + tab::State::Loader(l) => { + l.wallet_settings.wallet_id() == *wallet_id } + _ => false, + } { + Some(i) } else { None } From 88966c2b09d3025f730e648c523e7caa0e6487c9 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Thu, 24 Jul 2025 10:49:58 +0200 Subject: [PATCH 2/2] fix: move focused_tab if >= removed index If the focused tab index is before the removed tab index, then it must not change, if it is equal or after, because all the elements are moved to the left, the focused tab index must be decremented with 0 as minimum. --- liana-gui/src/gui/pane.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/liana-gui/src/gui/pane.rs b/liana-gui/src/gui/pane.rs index 52b6d61b..db5e9172 100644 --- a/liana-gui/src/gui/pane.rs +++ b/liana-gui/src/gui/pane.rs @@ -71,13 +71,11 @@ impl Pane { return None; } let tab = self.tabs.remove(i); - self.focused_tab = if self.tabs.is_empty() { - 0 - } else if i < self.tabs.len() - 1 { - i - } else { - self.tabs.len() - 1 - }; + + if self.focused_tab >= i { + self.focused_tab = self.focused_tab.saturating_sub(1); + } + Some(tab) }