feat!: cache last tree structure to simplify events
Things like key up/down dont require the items anymore to be used. Instead a cached last state from last render is used.
This commit is contained in:
+4
-4
@@ -142,11 +142,11 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> std::io::Res
|
||||
KeyCode::Char('\n' | ' ') => app.state.toggle_selected(),
|
||||
KeyCode::Left => app.state.key_left(),
|
||||
KeyCode::Right => app.state.key_right(),
|
||||
KeyCode::Down => app.state.key_down(&app.items),
|
||||
KeyCode::Up => app.state.key_up(&app.items),
|
||||
KeyCode::Down => app.state.key_down(),
|
||||
KeyCode::Up => app.state.key_up(),
|
||||
KeyCode::Esc => app.state.select(Vec::new()),
|
||||
KeyCode::Home => app.state.select_first(&app.items),
|
||||
KeyCode::End => app.state.select_last(&app.items),
|
||||
KeyCode::Home => app.state.select_first(),
|
||||
KeyCode::End => app.state.select_last(),
|
||||
KeyCode::PageDown => app.state.scroll_down(3),
|
||||
KeyCode::PageUp => app.state.scroll_up(3),
|
||||
_ => false,
|
||||
|
||||
Reference in New Issue
Block a user