Fix(handlers::main): Close ci after a command input
This commit is contained in:
parent
fe3849a7b7
commit
296ebdb0cd
|
@ -150,26 +150,29 @@ pub async fn handle(app: &mut App<'_>, input_event: &CrosstermEvent) -> Result<E
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
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
|
.lines()
|
||||||
.as_mut()
|
.get(0)
|
||||||
.expect("This is already checked")
|
.expect(
|
||||||
.lines()
|
"One line always exists,
|
||||||
.get(0)
|
and others can't exists
|
||||||
.expect(
|
because we collect on
|
||||||
"There can only be one line in the buffer, as we collect it on enter being inputted"
|
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
|
||||||
|
|
Reference in New Issue