From 5aa64bd7dc9c84b62252a3891c49791b8bddc0ab Mon Sep 17 00:00:00 2001 From: alice pellerin Date: Thu, 19 Mar 2026 02:00:05 -0500 Subject: [PATCH] covered_window_rows --- src/action.rs | 6 +++++- src/app/mod.rs | 9 +++++---- src/app/widget.rs | 7 +++++++ src/main.rs | 5 +++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/action.rs b/src/action.rs index b8e62a3..5036972 100644 --- a/src/action.rs +++ b/src/action.rs @@ -446,7 +446,11 @@ impl App { impl App { // in bytes const fn screen_size(&self) -> usize { - self.window_rows * BYTES_PER_LINE + self.hex_rows() * BYTES_PER_LINE + } + + const fn hex_rows(&self) -> usize { + self.window_rows - self.covered_window_rows } const fn clamp_screen_to_cursor(&mut self) { diff --git a/src/app/mod.rs b/src/app/mod.rs index 7ba2b8e..022a176 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -13,6 +13,7 @@ pub struct App { pub contents: Vec, pub window_rows: usize, + pub covered_window_rows: usize, pub scroll_position: usize, pub cursor: Cursor, @@ -97,8 +98,9 @@ impl App { contents, - // -1 because of the status line - window_rows: window_size().unwrap().rows as usize - 1, + window_rows: window_size().unwrap().rows as usize, + // 1 because of the status line + covered_window_rows: 1, scroll_position: 0, cursor: Cursor::default(), @@ -124,8 +126,7 @@ impl App { #[allow(clippy::collapsible_match)] match event::read().unwrap() { Event::Resize(_, height) => { - // -1 because of the status line - self.window_rows = height as usize - 1; + self.window_rows = height as usize; } Event::Key(key_event) => self.handle_key(key_event), // Event::Mouse(mouse_event) => { diff --git a/src/app/widget.rs b/src/app/widget.rs index 98c14b7..638c2e7 100644 --- a/src/app/widget.rs +++ b/src/app/widget.rs @@ -43,6 +43,13 @@ impl Widget for &App { self.render_extra_statuses() .right_aligned() .render(status_line_area, buf); + + // if self.partial_action == Some(PartialAction::Space) { + // let input_field_area = Rect::new(area.x, area.bottom() - 2, area.width, 1); + // Span::from("/0F673 ") + // .on_dark_gray() + // .render(input_field_area, buf); + // } } } diff --git a/src/main.rs b/src/main.rs index a602836..5013b07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,7 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK; // TODO: // - multiple buffers (tabs) +// - add a field for 'lines not couting for hex height' to offset status/tab bar/search bar // - search // - modifications // - insert/append @@ -33,10 +34,10 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK; // - zz/zt/zb // - visual gg/G // - jumplist -// - f/t -// - ascii? +// - y/p // - [/] to cycle view offset? // - J jump to offset +// - under cursor? // future directions // - switch between cursor size u8s/u16s/u32s/u64s?