Open Recent: focus an already-open file through the shared lookup (#1620)

Co-authored-by: GLM <noreply@z.ai>
This commit is contained in:
Eduardo SoaresandGLM committed 2026-10-12 23:12:13 -03:00
1 parent 95a769eedc
commit a5e16bf556
1 file changed
+7 -5
+7 -5
View File
@@ -1200,11 +1200,13 @@ impl PdfCraftApp {
/// Open a file from a recent list: focus the tab already showing it, else open it (File ▸
/// Open Recent and the Home view's list share this).
pub fn open_recent(&mut self, path: &str) {
if let Some(i) = self.views.iter().position(|v| self.session.get(v.id).and_then(|d| d.path.as_deref()) == Some(path)) {
self.active = Some(i);
} else {
#[cfg(not(target_arch = "wasm32"))]
self.open_path(path);
#[cfg(not(target_arch = "wasm32"))]
{
if let Some(i) = self.view_showing(path) {
self.active = Some(i);
} else {
self.open_path(path);
}
}
}