Skip to content

Commit f6ce4fd

Browse files
committed
Fix TUI copy badge truncation helper
1 parent 9a24150 commit f6ce4fd

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/tui/ui.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ mod transitions;
102102
mod viewport;
103103

104104
use crate::tui::mermaid;
105+
#[cfg(test)]
106+
pub(crate) use box_utils::truncate_line_to_width;
105107
use box_utils::{
106108
line_plain_text, render_rounded_box, truncate_line_preserving_suffix_to_width,
107109
truncate_line_with_ellipsis_to_width,
108110
};
109-
#[cfg(test)]
110-
pub(crate) use box_utils::truncate_line_to_width;
111111
use changelog::get_grouped_changelog;
112112
#[cfg(test)]
113113
use changelog::{ChangelogEntry, group_changelog_entries, parse_changelog_from};

src/tui/ui_tests/basic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use super::*;
22
use crate::tui::ui::{
33
FlickerFrameSample, FramePerfStats, SlowFrameSample, clear_flicker_frame_history_for_tests,
44
clear_slow_frame_history_for_tests, copy_badge_reserved_width, record_flicker_frame_sample,
5-
record_slow_frame_sample, reserve_copy_badge_margins,
6-
truncate_copy_badge_line_to_width,
5+
record_slow_frame_sample, reserve_copy_badge_margins, truncate_copy_badge_line_to_width,
76
};
87

98
include!("basic/frame_flicker.rs");

src/tui/ui_viewport.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(crate) fn truncate_line_in_place_to_width(line: &mut Line<'static>, max_widt
8080
let mut remaining = max_width;
8181
let mut kept: Vec<Span<'static>> = Vec::new();
8282

83-
'spans: for span in line.spans.drain(..) {
83+
for span in line.spans.drain(..) {
8484
if remaining == 0 {
8585
break;
8686
}
@@ -97,7 +97,7 @@ pub(crate) fn truncate_line_in_place_to_width(line: &mut Line<'static>, max_widt
9797
for ch in span.content.chars() {
9898
let ch_width = unicode_width::UnicodeWidthChar::width(ch).unwrap_or(0);
9999
if ch_width > 0 && used.saturating_add(ch_width) > remaining {
100-
break 'spans;
100+
break;
101101
}
102102
text.push(ch);
103103
used = used.saturating_add(ch_width);

0 commit comments

Comments
 (0)