From 5aaff9ea3bcd613a06c5e7bba17851fc0a393d50 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sun, 2 Jun 2024 13:55:23 +0200 Subject: [PATCH] fix: activate nav bar item with matching location --- src/app.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app.rs b/src/app.rs index 04481dd..d33652d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1628,6 +1628,18 @@ impl Application for App { commands.push(self.update(action.message(Some(entity)))); } tab::Command::ChangeLocation(tab_title, tab_path) => { + // Activate nav bar item with matching location. + let nav_bar_id = self.nav_model.iter().find(|&id| { + self.nav_model + .data::(id) + .map(|location| &tab_path == location) + .unwrap_or_default() + }); + + if let Some(id) = nav_bar_id { + self.nav_model.activate(id); + } + self.tab_model.text_set(entity, tab_title); commands.push(Command::batch([ self.update_title(),