notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 6de58d8203a60868b476af58421e49fb046ba91d
parent 348454cb28d550b31d9a025c8be56f162ecb3253
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 26 Jan 2026 17:49:55 -0800

dave: fix diff view max_height inside ScrollArea

The previous change used ui.available_height() * 0.8, but inside a
ScrollArea available_height() returns infinity. Use screen_rect()
height instead, clamped between 200-500px.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/ui/diff.rs | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/crates/notedeck_dave/src/ui/diff.rs b/crates/notedeck_dave/src/ui/diff.rs @@ -10,6 +10,11 @@ const LINE_NUMBER_COLOR: Color32 = Color32::from_rgb(128, 128, 128); pub fn file_update_ui(update: &FileUpdate, ui: &mut Ui) { let diff_lines = update.compute_diff(); + // Use screen height for max_height calculation since we're inside a ScrollArea + // where available_height() returns infinity + let screen_height = ui.ctx().screen_rect().height(); + let max_diff_height = (screen_height * 0.5).max(200.0).min(500.0); + // Code block frame egui::Frame::new() .fill(ui.visuals().extreme_bg_color) @@ -17,7 +22,7 @@ pub fn file_update_ui(update: &FileUpdate, ui: &mut Ui) { .corner_radius(4.0) .show(ui, |ui| { egui::ScrollArea::vertical() - .max_height(ui.available_height() * 0.8) + .max_height(max_diff_height) .show(ui, |ui| { render_diff_lines(&diff_lines, &update.update_type, ui); });