forked from 1b-agent/opencadstudio-upstream
feat(ui): elide overflowing text, tooltip full layer name
iced has no built-in ellipsis, so long user content (file names, layer names, paths, property values) wrapped or spilled past fixed-width panels. Add an `elide` helper (char-budget truncation with a trailing ellipsis) and apply it to the layer manager, properties panel, document tabs, recent-files list and the save dialog. In the layer manager a truncated name reveals its full text in a cursor-following tooltip on hover, so the column need not be widened. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
b3aadf569e
commit
ff10f8a89a
5 files changed
+111
-32
No files matched your search
+4
-4
@@ -1626,7 +1626,7 @@ pub(super) fn doc_tab_bar<'a>(tabs: &'a [DocumentTab], active_tab: usize) -> Ele
|
||||
|
||||
for (idx, tab) in tabs.iter().enumerate() {
|
||||
let is_active = idx == active_tab;
|
||||
let name = tab.tab_display_name();
|
||||
let name = crate::ui::text_util::elide(&tab.tab_display_name(), 24);
|
||||
let label = if tab.dirty {
|
||||
format!("● {}", name)
|
||||
} else {
|
||||
@@ -2977,7 +2977,7 @@ fn save_as_dialog_window<'a>(
|
||||
row![
|
||||
text(icon).size(13),
|
||||
Space::new().width(6),
|
||||
text(name.as_str()).size(13).color(color),
|
||||
text(crate::ui::text_util::elide(name.as_str(), 48)).size(13).color(color),
|
||||
]
|
||||
.align_y(iced::Alignment::Center),
|
||||
)
|
||||
@@ -3395,8 +3395,8 @@ pub(super) fn recent_files_panel<'a>(recents: &'a [std::path::PathBuf]) -> Eleme
|
||||
let path_for_open = path.clone();
|
||||
let open_btn = button(
|
||||
column![
|
||||
text(name).size(12).color(TEXT),
|
||||
text(dir).size(10).color(MUTED),
|
||||
text(crate::ui::text_util::elide(&name, 32)).size(12).color(TEXT),
|
||||
text(crate::ui::text_util::elide(&dir, 42)).size(10).color(MUTED),
|
||||
]
|
||||
.spacing(2),
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user