fix repeated actions error, add yank message
This commit is contained in:
+7
-1
@@ -34,7 +34,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn yank(&mut self) {
|
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
|
self.primary_cursor_register = current_buffer
|
||||||
.contents[current_buffer.primary_cursor.range()]
|
.contents[current_buffer.primary_cursor.range()]
|
||||||
@@ -46,5 +46,11 @@ impl App {
|
|||||||
current_buffer.contents[cursor.range()].to_vec()
|
current_buffer.contents[cursor.range()].to_vec()
|
||||||
})
|
})
|
||||||
.collect();
|
.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
@@ -282,7 +282,11 @@ impl Buffer {
|
|||||||
self.combine_cursors_if_overlapping();
|
self.combine_cursors_if_overlapping();
|
||||||
self.clamp_screen_to_primary_cursor(window_size);
|
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
@@ -35,24 +35,21 @@ const LINES_OF_PADDING: usize = 5;
|
|||||||
const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - write docs
|
|
||||||
// - simonomi.dev/hexapoda?
|
|
||||||
// - config
|
|
||||||
// - schema!!
|
|
||||||
// - uhhhhh?
|
|
||||||
// - update showcase
|
|
||||||
// - fix scroll clamping
|
// - fix scroll clamping
|
||||||
// - inspector translations for varint
|
// - fix scrolling in select mode
|
||||||
// - repeated actions may only be cursor actions
|
// - shouldn't clamp tail
|
||||||
// - shouldn't crash
|
// - `go` goto entered offset
|
||||||
// - scrolling in select mode
|
|
||||||
// - M mark at selected offset (like Jm)
|
|
||||||
// - search
|
// - 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
|
// - diffing
|
||||||
// - doesn't have to be anything fancy, just compare each byte 1:1
|
// - doesn't have to be anything fancy, just compare each byte 1:1
|
||||||
|
// - sync scroll ? sync selections ??
|
||||||
// - s/A-k/A-K
|
// - s/A-k/A-K
|
||||||
// - (not) sm select marks
|
// - sm select marks
|
||||||
// - C-a/C-x
|
// - C-a/C-x
|
||||||
// - +/- to edit selected bytes by amount ?
|
// - +/- to edit selected bytes by amount ?
|
||||||
// - operate on entire selection (u16/u32/etc)
|
// - operate on entire selection (u16/u32/etc)
|
||||||
@@ -71,7 +68,6 @@ const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
|||||||
// - jumplist
|
// - jumplist
|
||||||
// - p
|
// - p
|
||||||
// - [/] to cycle view offset?
|
// - [/] to cycle view offset?
|
||||||
// - gj jump to entered offset
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let arguments = Arguments::parse();
|
let arguments = Arguments::parse();
|
||||||
|
|||||||
Reference in New Issue
Block a user