diff --git a/src/app/actions.rs b/src/app/actions.rs index 1336c04..ea2adeb 100644 --- a/src/app/actions.rs +++ b/src/app/actions.rs @@ -34,7 +34,7 @@ impl App { } pub fn yank(&mut self) { - let current_buffer = &self.buffers[self.current_buffer_index]; + let current_buffer = &mut self.buffers[self.current_buffer_index]; self.primary_cursor_register = current_buffer .contents[current_buffer.primary_cursor.range()] @@ -46,5 +46,11 @@ impl App { current_buffer.contents[cursor.range()].to_vec() }) .collect(); + + current_buffer.alert_message = if current_buffer.cursors.is_empty() { + "yanked 1 selection".into() + } else { + format!("yanked {} selections", current_buffer.cursors.len() + 1).into() + }; } } diff --git a/src/buffer.rs b/src/buffer.rs index 0265595..6553a11 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -282,7 +282,11 @@ impl Buffer { self.combine_cursors_if_overlapping(); self.clamp_screen_to_primary_cursor(window_size); }, - _ => panic!("repeated actions may only be cursor actions"), + _ => { + self.alert_message = Span::from( + "only cursor actions may be repeated" + ).red(); + } } } } diff --git a/src/main.rs b/src/main.rs index 940b9f5..d1bdb75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,24 +35,21 @@ const LINES_OF_PADDING: usize = 5; const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE; // TODO: -// - write docs -// - simonomi.dev/hexapoda? -// - config -// - schema!! -// - uhhhhh? -// - update showcase // - fix scroll clamping -// - inspector translations for varint -// - repeated actions may only be cursor actions -// - shouldn't crash -// - scrolling in select mode -// - M mark at selected offset (like Jm) +// - fix scrolling in select mode +// - shouldn't clamp tail +// - `go` goto entered offset // - search -// - ascii and bytes (`/` and `A-/`?) +// - `/` hex, `A-/` ascii +// - if non-hex-digit typed, search ascii +// - update showcase +// - inspector translations for varint +// - M mark at selected offset (like Jm) // - diffing // - doesn't have to be anything fancy, just compare each byte 1:1 +// - sync scroll ? sync selections ?? // - s/A-k/A-K -// - (not) sm select marks +// - sm select marks // - C-a/C-x // - +/- to edit selected bytes by amount ? // - operate on entire selection (u16/u32/etc) @@ -71,7 +68,6 @@ const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE; // - jumplist // - p // - [/] to cycle view offset? -// - gj jump to entered offset fn main() { let arguments = Arguments::parse();