Skip to content

Commit 749fd35

Browse files
hojjatabdollahiwash2
authored andcommitted
fix: Ellipsize tab_text and use text widget instead of custom impl
1 parent e626735 commit 749fd35

3 files changed

Lines changed: 7 additions & 205 deletions

File tree

src/shell/element/stack.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ use std::{
8181
};
8282

8383
mod tab;
84-
mod tab_text;
8584
mod tabs;
8685

8786
use self::{

src/shell/element/stack/tab.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ use cosmic::{
99
Border, Clipboard, Color, Length, Rectangle, Shell, Size, alignment, event,
1010
layout::{Layout, Limits, Node},
1111
mouse, overlay, renderer,
12+
text::{Ellipsize, EllipsizeHeightLimit, Shaping, Wrapping},
1213
widget::{Id, Widget, operation::Operation, tree::Tree},
1314
},
1415
iced_widget::scrollable::AbsoluteOffset,
1516
theme,
16-
widget::{Icon, icon::from_name},
17+
widget::{Icon, icon::from_name, text},
1718
};
1819

19-
use super::tab_text::tab_text;
20-
2120
#[derive(Clone, Copy)]
2221
pub(super) enum TabRuleTheme {
2322
ActiveActivated,
@@ -196,9 +195,12 @@ impl<Message: TabMessage + 'static> Tab<Message> {
196195
.padding([2, 4])
197196
.center_y(Length::Fill)
198197
.into(),
199-
tab_text(self.title, self.active)
198+
text::body(self.title)
200199
.font(self.font)
201-
.font_size(14.0)
200+
.wrapping(Wrapping::None)
201+
.shaping(Shaping::Advanced)
202+
.ellipsize(Ellipsize::End(EllipsizeHeightLimit::Lines(1)))
203+
.align_y(alignment::Vertical::Center)
202204
.height(Length::Fill)
203205
.width(Length::Fill)
204206
.into(),

src/shell/element/stack/tab_text.rs

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)