Skip to content

Commit

Permalink
bugfix: fix duplicate tab_id by monotonic counter for unique tab IDs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hilaolu authored Feb 7, 2025
1 parent a460111 commit 4c489dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontends/rioterm/src/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ pub struct Router<'a> {
pub font_library: Box<rio_backend::sugarloaf::font::FontLibrary>,
pub config_route: Option<WindowId>,
pub clipboard: Rc<RefCell<Clipboard>>,
next_tab_id: u64,
}

impl Router<'_> {
Expand Down Expand Up @@ -194,6 +195,7 @@ impl Router<'_> {
config_route: None,
font_library: Box::new(font_library),
clipboard,
next_tab_id: 0,
}
}

Expand Down Expand Up @@ -310,7 +312,9 @@ impl Router<'_> {
open_url: Option<String>,
) {
let tab_id = if config.navigation.is_native() {
Some(self.routes.len().to_string())
let id = self.next_tab_id;
self.next_tab_id = self.next_tab_id.wrapping_add(1);
Some(id.to_string())
} else {
None
};
Expand Down

0 comments on commit 4c489dc

Please sign in to comment.