rhysd/tui-textarea

the trait `From<KeyEvent>` is not implemented for `tui_textarea::Input`

rvigo opened this issue · 2 comments

rvigo commented

Hi, after update the crossterm crate to version 0.26.0, I started getting this error message at text_area.input():

the trait `From<KeyEvent>` is not implemented for `tui_textarea::Input`

My code:

  pub fn handle(&mut self, key_event: KeyEvent) {
        match key_event {
            KeyEvent {
                code: KeyCode::Esc | KeyCode::Enter | KeyCode::Down | KeyCode::Up,
                ..
            } => self.on_focus = false,
            input => {
                self.text_area.input(input);
                self.buffer = self.text_area.lines()[0].clone()
            }
        }
    }

the KeyEvent is from crossterm::event::KeyEvent
It
Cargo.toml:

[dependencies]
# another non-TUI related deps
tui = "0.19.0" # uses crossterm as default
crossterm = "0.26.0"
tui-textarea = { version = "0.2.0", features = ["crossterm"] }
# another non-TUI related deps

It's like the code can't read the impl From<KeyEvent> for Input int the input.rs class

rhysd commented

crossterm 0.26 is not supported yet because tui doesn't support it yet. Since this library is an extension for tui, dependency versions need to be aligned.

rvigo commented

well, this explains everything...👀
I'll close this issue, thanks for the help!!!