mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
i dont know why that worked
This commit is contained in:
parent
4ae62c5bc2
commit
b73aa8a0dc
17 changed files with 552 additions and 481 deletions
|
|
@ -13,19 +13,19 @@ impl Rows {
|
|||
}
|
||||
|
||||
impl Device for Rows {
|
||||
fn handle (&mut self, event: &EngineEvent) -> Usually<()> {
|
||||
fn handle (&mut self, event: &AppEvent) -> Usually<()> {
|
||||
if !self.focused {
|
||||
match event {
|
||||
EngineEvent::Input(Event::Key(KeyEvent { code: KeyCode::Esc, .. })) => {
|
||||
AppEvent::Input(Event::Key(KeyEvent { code: KeyCode::Esc, .. })) => {
|
||||
self.focused = true;
|
||||
self.items[self.focus].handle(&EngineEvent::Blur)?;
|
||||
self.items[self.focus].handle(&AppEvent::Blur)?;
|
||||
Ok(())
|
||||
},
|
||||
_ => self.items[self.focus].handle(event)
|
||||
}
|
||||
} else {
|
||||
match event {
|
||||
EngineEvent::Input(event) => match event {
|
||||
AppEvent::Input(event) => match event {
|
||||
Event::Key(KeyEvent { code: KeyCode::Up, .. }) => {
|
||||
if self.focus == 0 {
|
||||
self.focus = self.items.len();
|
||||
|
|
@ -40,11 +40,11 @@ impl Device for Rows {
|
|||
},
|
||||
Event::Key(KeyEvent { code: KeyCode::Enter, .. }) => {
|
||||
self.focused = false;
|
||||
self.items[self.focus].handle(&EngineEvent::Focus)?;
|
||||
self.items[self.focus].handle(&AppEvent::Focus)?;
|
||||
},
|
||||
Event::Key(KeyEvent { code: KeyCode::Esc, .. }) => {
|
||||
self.focused = true;
|
||||
self.items[self.focus].handle(&EngineEvent::Blur)?;
|
||||
self.items[self.focus].handle(&AppEvent::Blur)?;
|
||||
},
|
||||
_ => {
|
||||
println!("{event:?}");
|
||||
|
|
@ -93,7 +93,7 @@ impl Columns {
|
|||
}
|
||||
|
||||
impl Device for Columns {
|
||||
fn handle (&mut self, event: &EngineEvent) -> Usually<()> {
|
||||
fn handle (&mut self, event: &AppEvent) -> Usually<()> {
|
||||
if self.focused {
|
||||
self.items[self.focus].handle(event)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue