Skip to content

Commit 687f955

Browse files
committed
Adjust labels.
1 parent b7bcd4e commit 687f955

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

src/app.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ impl Minimon {
16121612
network_labels.push(widget::vertical_space().into());
16131613
}
16141614

1615-
network_labels.push(Row::from_vec(dl_row).spacing(0).padding(0).into());
1615+
network_labels.push(Row::from_vec(dl_row).into());
16161616

16171617
if nw_combined {
16181618
let mut ul_row = Vec::new();
@@ -1624,7 +1624,7 @@ impl Minimon {
16241624
format_label(self.network1.upload_label(sample_rate_ms, unit_len)).into(),
16251625
);
16261626

1627-
network_labels.push(Row::from_vec(ul_row).spacing(0).padding(0).into());
1627+
network_labels.push(Row::from_vec(ul_row).into());
16281628
network_labels.push(widget::vertical_space().into());
16291629
}
16301630

@@ -1651,7 +1651,7 @@ impl Minimon {
16511651
}
16521652
ul_row.push(format_label(self.network2.upload_label(sample_rate_ms, unit_len)).into());
16531653

1654-
network_labels.push(Row::from_vec(ul_row).spacing(0).padding(0).into());
1654+
network_labels.push(Row::from_vec(ul_row).into());
16551655

16561656
elements.push_back(Column::from_vec(network_labels).into());
16571657
}
@@ -1977,10 +1977,10 @@ impl Minimon {
19771977
} else if let Some(w) = width {
19781978
widget::text(text)
19791979
.size(size)
1980-
.width(w)
1980+
.width(w).wrapping(iced::core::text::Wrapping::None)
19811981
.align_x(Horizontal::Center)
19821982
} else {
1983-
widget::text(text).size(size)
1983+
widget::text(text).size(size).wrapping(iced::core::text::Wrapping::None)
19841984
}
19851985
}
19861986

@@ -2083,7 +2083,7 @@ impl Minimon {
20832083
.lines
20842084
.first()
20852085
.and_then(|line| line.layout_opt())
2086-
.and_then(|layouts| layouts.first().map(|layout| layout.w.ceil()))
2086+
.and_then(|layouts| layouts.first().map(|layout| layout.w.ceil()+2.0))
20872087
}
20882088

20892089
fn calculate_max_label_widths(&mut self) {

src/sensors/disks.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ impl Disks {
403403

404404
formatted.push_str(units[unit_index]);
405405

406+
if format == UnitVariant::Long {
407+
let padding = 9usize.saturating_sub(formatted.len());
408+
if padding > 0 {
409+
formatted = " ".repeat(padding) + &formatted;
410+
}
411+
}
412+
406413
formatted
407414
}
408415

src/sensors/network.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ impl Network {
468468

469469
result.push_str(unit_str);
470470

471+
if format == UnitVariant::Long {
472+
let padding = 9usize.saturating_sub(result.len());
473+
if padding > 0 {
474+
result = " ".repeat(padding) + &result;
475+
}
476+
}
477+
471478
result
472479
}
473480

0 commit comments

Comments
 (0)