covered_window_rows

This commit is contained in:
alice pellerin
2026-03-19 02:00:05 -05:00
parent ce2d753f96
commit 5aa64bd7dc
4 changed files with 20 additions and 7 deletions
+5 -1
View File
@@ -446,7 +446,11 @@ impl App {
impl App { impl App {
// in bytes // in bytes
const fn screen_size(&self) -> usize { 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) { const fn clamp_screen_to_cursor(&mut self) {
+5 -4
View File
@@ -13,6 +13,7 @@ pub struct App {
pub contents: Vec<u8>, pub contents: Vec<u8>,
pub window_rows: usize, pub window_rows: usize,
pub covered_window_rows: usize,
pub scroll_position: usize, pub scroll_position: usize,
pub cursor: Cursor, pub cursor: Cursor,
@@ -97,8 +98,9 @@ impl App {
contents, contents,
// -1 because of the status line window_rows: window_size().unwrap().rows as usize,
window_rows: window_size().unwrap().rows as usize - 1, // 1 because of the status line
covered_window_rows: 1,
scroll_position: 0, scroll_position: 0,
cursor: Cursor::default(), cursor: Cursor::default(),
@@ -124,8 +126,7 @@ impl App {
#[allow(clippy::collapsible_match)] #[allow(clippy::collapsible_match)]
match event::read().unwrap() { match event::read().unwrap() {
Event::Resize(_, height) => { Event::Resize(_, height) => {
// -1 because of the status line self.window_rows = height as usize;
self.window_rows = height as usize - 1;
} }
Event::Key(key_event) => self.handle_key(key_event), Event::Key(key_event) => self.handle_key(key_event),
// Event::Mouse(mouse_event) => { // Event::Mouse(mouse_event) => {
+7
View File
@@ -43,6 +43,13 @@ impl Widget for &App {
self.render_extra_statuses() self.render_extra_statuses()
.right_aligned() .right_aligned()
.render(status_line_area, buf); .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);
// }
} }
} }
+3 -2
View File
@@ -18,6 +18,7 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK;
// TODO: // TODO:
// - multiple buffers (tabs) // - multiple buffers (tabs)
// - add a field for 'lines not couting for hex height' to offset status/tab bar/search bar
// - search // - search
// - modifications // - modifications
// - insert/append // - insert/append
@@ -33,10 +34,10 @@ const CHUNKS_PER_LINE: usize = BYTES_PER_LINE / BYTES_PER_CHUNK;
// - zz/zt/zb // - zz/zt/zb
// - visual gg/G // - visual gg/G
// - jumplist // - jumplist
// - f/t // - y/p
// - ascii?
// - [/] to cycle view offset? // - [/] to cycle view offset?
// - J jump to offset // - J jump to offset
// - under cursor?
// future directions // future directions
// - switch between cursor size u8s/u16s/u32s/u64s? // - switch between cursor size u8s/u16s/u32s/u64s?