Exit bar visualization if any key is pressed other than left and right arrow keys. (#2623)

This commit is contained in:
Andrés N. Robalino 2020-09-30 14:34:29 -05:00 committed by GitHub
parent a56abb6502
commit b7bc4c1f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,6 +64,8 @@ fn display(model: &nu_data::utils::Model) -> Result<(), Box<dyn Error>> {
match rx.recv()? { match rx.recv()? {
Event::Input(event) => match event.code { Event::Input(event) => match event.code {
KeyCode::Left => app.on_left(),
KeyCode::Right => app.on_right(),
KeyCode::Char('q') => { KeyCode::Char('q') => {
disable_raw_mode()?; disable_raw_mode()?;
execute!( execute!(
@ -74,9 +76,16 @@ fn display(model: &nu_data::utils::Model) -> Result<(), Box<dyn Error>> {
terminal.show_cursor()?; terminal.show_cursor()?;
break; break;
} }
KeyCode::Left => app.on_left(), _ => {
KeyCode::Right => app.on_right(), disable_raw_mode()?;
_ => {} execute!(
terminal.backend_mut(),
LeaveAlternateScreen,
DisableMouseCapture
)?;
terminal.show_cursor()?;
break;
}
}, },
Event::Tick => {} Event::Tick => {}
} }