Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further improvements #13

Open
5 tasks
hellow554 opened this issue Sep 27, 2023 · 1 comment
Open
5 tasks

Further improvements #13

hellow554 opened this issue Sep 27, 2023 · 1 comment

Comments

@hellow554
Copy link
Owner

hellow554 commented Sep 27, 2023

  • 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
  • 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
  • Goto function
    • Function that takes a usize and jumps to that very position
  • 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) -> char should be good
    • Having multi-byte encoding is probably way too much to ask and not feasible for a hexcode viewer
@ddrcode
Copy link
Contributor

ddrcode commented Sep 28, 2023

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))
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants