Keep Open clear of document tabs

This commit is contained in:
Dylan M. Taylor
2026-11-20 13:50:58 -05:00
parent 8edf1a652e
commit f0bdb92ae1
3 changed files with 8 additions and 2 deletions
-1
View File
@@ -97,7 +97,6 @@ fn title_bar(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
app.combine_tab.focused = false;
}
doc_tabs::strip(app, ui, Place::Main);
Button::command("file.open").icon(IconId::new("plus")).show(ui);
},
|ui, _| {
IconButton::command(IconId::new("messages-square"), "help.discord").show(ui);
+7
View File
@@ -2,7 +2,9 @@
//! [`DocView`](crate::DocView) keyed by its view key, since split view can show one document in two
//! tabs; the Combine files tab sits last in the main strip and is never moved.
use craft::behavior::IconId;
use craft::platform::open::CAN_REVEAL;
use craft::ui::buttons::Button;
use craft::ui::contract::{Props as _, Show as _, ShowContainer as _};
use craft::ui::menu::{Menu, MenuItem};
use craft::ui::tabs::{DocumentTab, DocumentTabs, DocumentTabsEvent};
@@ -45,6 +47,11 @@ pub(crate) fn strip(app: &mut PdfCraftApp, ui: &mut egui::Ui, place: Place) {
};
let label = if place == Place::Main { tl!("Documents") } else { tl!("Split view documents") };
let mut strip = DocumentTabs::new(label.to_string(), &tabs).reorderable(true);
if place == Place::Main {
strip = strip.trailing(|ui| {
Button::command("file.open").icon(IconId::new("plus")).show(ui);
});
}
if let Some(selected) = selected {
strip = strip.selected(selected);
}
+1 -1
View File
@@ -708,7 +708,7 @@ fn tabs_shrink_to_fit_then_arrows_step_through_them_and_open_stays_in_sight() {
assert!(open.right() <= discord.left(), "Open {open:?} must not run under Discord {discord:?}");
let mut previous_right = f32::MIN;
for i in 0..5 {
let tab = h.get_by_label(&name(i)).rect();
let tab = h.get_by_role_and_label(egui::accesskit::Role::Tab, &name(i)).rect();
assert!(tab.left() >= previous_right - 0.5, "tabs must not overlap: {i} at {tab:?}");
assert!(tab.right() <= open.left() + 0.5, "every tab fits before Open: {i} at {tab:?}, Open at {open:?}");
previous_right = tab.right();