rendering
This commit is contained in:
parent
36d698a3e1
commit
49cd6d6ab6
8 changed files with 178 additions and 157 deletions
|
|
@ -27,9 +27,11 @@ impl ScreenView for SubconsciousScreen {
|
|||
fn label(&self) -> &'static str { "subconscious" }
|
||||
|
||||
fn tick(&mut self, frame: &mut Frame, area: Rect,
|
||||
key: Option<KeyEvent>, app: &mut App) -> Option<ScreenAction> {
|
||||
events: &[ratatui::crossterm::event::Event], app: &mut App) {
|
||||
// Handle keys
|
||||
if let Some(key) = key {
|
||||
for event in events {
|
||||
if let ratatui::crossterm::event::Event::Key(key) = event {
|
||||
if key.kind != ratatui::crossterm::event::KeyEventKind::Press { continue; }
|
||||
match key.code {
|
||||
KeyCode::Up if !self.log_view => {
|
||||
self.selected = self.selected.saturating_sub(1);
|
||||
|
|
@ -44,11 +46,11 @@ impl ScreenView for SubconsciousScreen {
|
|||
KeyCode::Esc | KeyCode::Left if self.log_view => {
|
||||
self.log_view = false;
|
||||
}
|
||||
KeyCode::Esc if !self.log_view => return Some(ScreenAction::Switch(0)),
|
||||
KeyCode::PageUp => { self.scroll = self.scroll.saturating_sub(20); }
|
||||
KeyCode::PageDown => { self.scroll += 20; }
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw
|
||||
|
|
@ -57,7 +59,6 @@ impl ScreenView for SubconsciousScreen {
|
|||
} else {
|
||||
self.draw_list(frame, area, app);
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue