Skip to content

Commit f1aa2a0

Browse files
sumaclaude
andcommitted
Make MAX_VIRTUAL_HEIGHT pub and remove hardcoded duplicate in render.rs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 080583d commit f1aa2a0

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,9 +2867,9 @@ impl HexEditor {
28672867
fn recompute_logical_row_from_offset(&mut self, row_count: usize, offset: gpui::Pixels) {
28682868
let row_height = self.row_height();
28692869
let actual_total_height = row_count as f64 * row_height;
2870-
if actual_total_height > 10_000_000.0 {
2870+
if actual_total_height > ui::MAX_VIRTUAL_HEIGHT {
28712871
let scroll_abs = (-f64::from(f32::from(offset))).max(0.0);
2872-
let scroll_ratio = (scroll_abs / 10_000_000.0).clamp(0.0, 1.0);
2872+
let scroll_ratio = (scroll_abs / ui::MAX_VIRTUAL_HEIGHT).clamp(0.0, 1.0);
28732873
let first_visible = (scroll_ratio * row_count as f64).floor() as usize;
28742874
self.tab_mut().scroll_logical_row = Some(first_visible);
28752875
}

src/ui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ pub const ROW_HEIGHT: f64 = 24.0;
364364

365365
/// Maximum virtual height to avoid f32 precision issues
366366
/// f32 loses precision above ~16 million, so we cap at 10 million pixels
367-
const MAX_VIRTUAL_HEIGHT: f64 = 10_000_000.0;
367+
pub const MAX_VIRTUAL_HEIGHT: f64 = 10_000_000.0;
368368

369369
/// Buffer rows above/below visible area to prevent flickering during scroll
370370
const BUFFER_ROWS: usize = 10;

0 commit comments

Comments
 (0)