From 8b67f70573f579a4b27d9587105fd22b8f8ae6fa Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 31 Jan 2025 12:53:40 +0200 Subject: [PATCH] fix tabs order on session restore --- src/app/browser/window/tab.rs | 6 ++++-- src/app/browser/window/tab/item/database.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 0fe71d6b..b7493ab4 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -331,8 +331,10 @@ impl Tab { for tab_record in tab_records { for item_record in item::restore(transaction, tab_record.id)? { // Generate new `TabPage` with blank `Widget` - let (tab_page, target_child) = - new_tab_page(&self.tab_view, Position::After); + let (tab_page, target_child) = new_tab_page( + &self.tab_view, + Position::Number(item_record.page_position), + ); // Init new tab item let item = Rc::new(Item::build( diff --git a/src/app/browser/window/tab/item/database.rs b/src/app/browser/window/tab/item/database.rs index 4d19cd1a..f003ca31 100644 --- a/src/app/browser/window/tab/item/database.rs +++ b/src/app/browser/window/tab/item/database.rs @@ -3,6 +3,7 @@ use sqlite::{Error, Transaction}; pub struct Table { pub id: i64, // pub app_browser_window_tab_id: i64, not in use + pub page_position: i32, pub is_pinned: bool, pub is_selected: bool, } @@ -50,19 +51,21 @@ pub fn select(tx: &Transaction, app_browser_window_tab_id: i64) -> Result