aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-29 00:48:10 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-29 00:48:10 +0300
commit324e625c60658ab0de46928be300fc1804af48df (patch)
tree4cafa5c8f6794c64863cd1755d93010875af68d3 /src/app
parent1bb2676388a3541360ca106354075d67376a6843 (diff)
fix: wrap update preview copy
Diffstat (limited to 'src/app')
-rw-r--r--src/app/input/overlays.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/app/input/overlays.rs b/src/app/input/overlays.rs
index 7d2a8ff3..42a2cfef 100644
--- a/src/app/input/overlays.rs
+++ b/src/app/input/overlays.rs
@@ -385,7 +385,15 @@ impl AppState {
.release_notes
.as_ref()
.is_some_and(|notes| notes.preview);
- Some(crate::ui::release_notes_sections(body, preview).notes_body)
+ Some(
+ crate::ui::release_notes_sections(
+ body,
+ preview,
+ &self.update_install_command,
+ &self.palette,
+ )
+ .notes_body,
+ )
}
fn release_notes_scroll_metrics(&self) -> Option<crate::pane::ScrollMetrics> {
@@ -394,17 +402,14 @@ impl AppState {
let viewport_rows = body.height.max(1) as usize;
let lines = crate::ui::release_notes_display_lines(notes, &self.palette);
- let rows_for_width = |wrap_width: usize| {
- lines
- .iter()
- .map(|(width, _)| width.max(&1).div_ceil(wrap_width.max(1)))
- .sum::<usize>()
+ let rows_for_width = |wrap_width: u16| {
+ crate::ui::release_notes_wrapped_line_count(&lines, wrap_width.max(1))
};
- let full_width = body.width.max(1) as usize;
+ let full_width = body.width.max(1);
let mut total_rows = rows_for_width(full_width);
let wrap_width = if total_rows > viewport_rows && full_width > 1 {
- body.width.saturating_sub(1).max(1) as usize
+ body.width.saturating_sub(1).max(1)
} else {
full_width
};
@@ -496,17 +501,14 @@ impl AppState {
let viewport_rows = body.height.max(1) as usize;
let lines = crate::ui::product_announcement_display_lines(announcement, &self.palette);
- let rows_for_width = |wrap_width: usize| {
- lines
- .iter()
- .map(|(width, _)| width.max(&1).div_ceil(wrap_width.max(1)))
- .sum::<usize>()
+ let rows_for_width = |wrap_width: u16| {
+ crate::ui::release_notes_wrapped_line_count(&lines, wrap_width.max(1))
};
- let full_width = body.width.max(1) as usize;
+ let full_width = body.width.max(1);
let mut total_rows = rows_for_width(full_width);
let wrap_width = if total_rows > viewport_rows && full_width > 1 {
- body.width.saturating_sub(1).max(1) as usize
+ body.width.saturating_sub(1).max(1)
} else {
full_width
};