cursive_hexview
cursive_hexview copied to clipboard
Further improvements
trafficstars
- [ ] Add callback for when some data has been changed
- Probably something like
FnMut(usize, u8) -> () - As an alternative use a Broadcast like thing which would be more easy to implement
- Probably something like
- [ ] Add callback when the position has been changed
- Something like
FnMut(usize) -> () - As an alternative use a Broadcast like thing which would be more easy to implement
- Something like
- [ ] Goto function
- Function that takes a
usizeand jumps to that very position
- Function that takes a
- [ ] PageUp/-Down support
- I'm not sure how many lines should be jumped though. Any ideas?
- [ ] Add support for non-ascii encoder
- I think having a single mapping is fine, so
Fn(u8) -> charshould be good - Having multi-byte encoding is probably way too much to ask and not feasible for a hexcode viewer
- I think having a single mapping is fine, so
Wow - I love the list - thanks for composing it. Most likely I am going to use all these planned features in my project.
Regarding page up/down - Cursive's scroller.scroll_down (and up) automatically move by a visible area - so a "page". There is a bug in the documentation saying it's by one line, but definitely it's a page. Here is the recipe:
.on_pre_event_inner(Key::PageUp, |v, _| {
let scroller = v.get_scroller_mut();
if scroller.can_scroll_up() {
scroller.scroll_up(scroller.last_outer_size().y.saturating_sub(1));
}
Some(EventResult::Consumed(None))
})
.on_pre_event_inner(Key::PageDown, |v, _| {
let scroller = v.get_scroller_mut();
if scroller.can_scroll_down() {
scroller.scroll_down(scroller.last_outer_size().y.saturating_sub(1));
}
Some(EventResult::Consumed(None))
});