Fix(handlers::main): Close ci after a command input

This commit is contained in:
Benedikt Peetz 2023-07-24 23:54:45 +02:00
parent 0288bdb0ad
commit a3b49b17f4
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
1 changed files with 14 additions and 11 deletions

View File

@ -135,26 +135,29 @@ pub async fn handle_normal(app: &mut App<'_>, input_event: &CrosstermEvent) -> R
}; };
} }
central::InputPosition::CLI => { central::InputPosition::CLI => {
if let Some(_) = app.ui.cli { if let Some(cli) = &app.ui.cli {
match input { match input {
CrosstermEvent::Key(KeyEvent { CrosstermEvent::Key(KeyEvent {
code: KeyCode::Enter, code: KeyCode::Enter,
.. ..
}) => { }) => {
let ci_event = app.ui let ci_event = cli
.cli
.as_mut()
.expect("This is already checked")
.lines() .lines()
.get(0) .get(0)
.expect( .expect(
"There can only be one line in the buffer, as we collect it on enter being inputted" "One line always exists,
and others can't exists
because we collect on
enter",
) )
.to_owned(); .to_owned();
app.tx app.tx
.send(Event::LuaCommand(ci_event)) .send(Event::LuaCommand(ci_event))
.await .await
.context("Failed to send lua command to internal event stream")?; .context("Failed to send lua command to internal event stream")?;
app.tx
.send(Event::CommandEvent(Command::CommandLineHide, None))
.await?;
} }
_ => { _ => {
app.ui app.ui