add binary to inspector for single bytes
This commit is contained in:
@@ -378,6 +378,7 @@ impl Buffer {
|
|||||||
if next_cursor_index == self.cursors.len() {
|
if next_cursor_index == self.cursors.len() {
|
||||||
swap(&mut self.primary_cursor, &mut self.cursors[0]);
|
swap(&mut self.primary_cursor, &mut self.cursors[0]);
|
||||||
|
|
||||||
|
// TODO: is a full sort necessary ?
|
||||||
self.cursors.sort_by_key(|cursor| cursor.head);
|
self.cursors.sort_by_key(|cursor| cursor.head);
|
||||||
} else {
|
} else {
|
||||||
swap(&mut self.primary_cursor, &mut self.cursors[next_cursor_index]);
|
swap(&mut self.primary_cursor, &mut self.cursors[next_cursor_index]);
|
||||||
@@ -704,6 +705,15 @@ fn inspect(selection: &[u8]) -> Vec<Span<'static>> {
|
|||||||
|
|
||||||
let int = nat.and_then(|nat| nat_to_int_if_different(nat, selection.len()));
|
let int = nat.and_then(|nat| nat_to_int_if_different(nat, selection.len()));
|
||||||
|
|
||||||
|
let binary = nat
|
||||||
|
.filter(|_| selection.len() == 1)
|
||||||
|
.map(|nat| {
|
||||||
|
let lower_bits = nat & 0b1111;
|
||||||
|
let upper_bits = nat >> 4;
|
||||||
|
|
||||||
|
format!("{upper_bits:04b}_{lower_bits:04b}").into()
|
||||||
|
});
|
||||||
|
|
||||||
let utf8 = str::from_utf8(selection).ok()
|
let utf8 = str::from_utf8(selection).ok()
|
||||||
.filter(|_| selection.len() != 1)
|
.filter(|_| selection.len() != 1)
|
||||||
.map(|utf8| utf8.trim_suffix('\0'))
|
.map(|utf8| utf8.trim_suffix('\0'))
|
||||||
@@ -801,6 +811,7 @@ fn inspect(selection: &[u8]) -> Vec<Span<'static>> {
|
|||||||
int.map(|int| format!("{int}").into())
|
int.map(|int| format!("{int}").into())
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(nat.map(|nat| format!("{nat}").into()))
|
.chain(nat.map(|nat| format!("{nat}").into()))
|
||||||
|
.chain(binary)
|
||||||
.chain(utf8)
|
.chain(utf8)
|
||||||
.chain(fixedpoint2012_signed)
|
.chain(fixedpoint2012_signed)
|
||||||
.chain(fixedpoint2012)
|
.chain(fixedpoint2012)
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ impl Buffer {
|
|||||||
address: usize,
|
address: usize,
|
||||||
byte: u8
|
byte: u8
|
||||||
) -> Span<'static> {
|
) -> Span<'static> {
|
||||||
|
// TODO: checking this with lots of selections is slow
|
||||||
if self.partial_action == Some(PartialAction::Replace) &&
|
if self.partial_action == Some(PartialAction::Replace) &&
|
||||||
iter::once(&self.primary_cursor)
|
iter::once(&self.primary_cursor)
|
||||||
.chain(&self.cursors)
|
.chain(&self.cursors)
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ const BYTES_OF_PADDING: usize = LINES_OF_PADDING * BYTES_PER_LINE;
|
|||||||
// - update showcase
|
// - update showcase
|
||||||
// - fix scroll clamping
|
// - fix scroll clamping
|
||||||
// - inspector translations for varint
|
// - inspector translations for varint
|
||||||
|
// - t in select mode doesnt work right
|
||||||
|
// - repeat in select mode doesnt work right
|
||||||
|
// - gg/G in select mode
|
||||||
|
// - gl/gj in select mode
|
||||||
|
// - scrolling in select mode
|
||||||
|
// - +/- to edit selected bytes by amount
|
||||||
// - search
|
// - search
|
||||||
// - ascii and bytes (`/` and `A-/`?)
|
// - ascii and bytes (`/` and `A-/`?)
|
||||||
// - diffing
|
// - diffing
|
||||||
|
|||||||
Reference in New Issue
Block a user