fix repeated actions error, add yank message

This commit is contained in:
alice pellerin
2026-04-26 01:02:04 -05:00
parent fd63c6bd57
commit 3ad74cc3de
3 changed files with 22 additions and 16 deletions
+7 -1
View File
@@ -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()
};
}
}
+5 -1
View File
@@ -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();
}
}
}
}
+10 -14
View File
@@ -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();