1
0
Fork 0

Fix(treewide): Resolve merge conflicts

This commit is contained in:
Benedikt Peetz 2023-07-26 22:25:08 +02:00
parent 855d487693
commit 84c13fd6f8
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
5 changed files with 24 additions and 22 deletions

View File

@ -4,14 +4,14 @@ use anyhow::{Error, Result};
use cli_log::{trace, warn}; use cli_log::{trace, warn};
use tokio::sync::oneshot; use tokio::sync::oneshot;
use crate::app::{ use crate::{app::{
command_interface::{ command_interface::{
lua_command_manager::{CommandTransferValue, Table}, lua_command_manager::{CommandTransferValue, Table},
Command, Command,
}, },
events::event_types::EventStatus, events::event_types::EventStatus,
App, App, status::State,
}; }, ui::central::InputPosition};
pub async fn handle( pub async fn handle(
app: &mut App<'_>, app: &mut App<'_>,
@ -99,14 +99,14 @@ pub async fn handle(
Command::SetModeNormal => { Command::SetModeNormal => {
app.status.set_state(State::Normal); app.status.set_state(State::Normal);
set_status_output!("Set input mode to Normal"); send_status_output!("Set input mode to Normal");
(EventStatus::Ok, "".to_owned()) EventStatus::Ok
} }
Command::SetModeInsert => { Command::SetModeInsert => {
app.status.set_state(State::Insert); app.status.set_state(State::Insert);
app.ui.set_input_position(InputPosition::MessageCompose); app.ui.set_input_position(InputPosition::MessageCompose);
set_status_output!("Set input mode to Insert"); send_status_output!("Set input mode to Insert");
(EventStatus::Ok, "".to_owned()) EventStatus::Ok
} }
Command::RoomMessageSend(msg) => { Command::RoomMessageSend(msg) => {

View File

@ -10,7 +10,7 @@ use crate::{
ui::central, ui::central,
}; };
pub async fn handle( pub async fn handle_normal(
app: &mut App<'_>, app: &mut App<'_>,
input_event: &CrosstermEvent, input_event: &CrosstermEvent,
) -> Result<EventStatus> { ) -> Result<EventStatus> {

View File

@ -5,7 +5,11 @@ use cli_log::trace;
use crossterm::event::Event as CrosstermEvent; use crossterm::event::Event as CrosstermEvent;
use tokio::sync::oneshot; use tokio::sync::oneshot;
use crate::app::{command_interface::{Command, lua_command_manager::CommandTransferValue}, status::State, App}; use crate::app::{
command_interface::{lua_command_manager::CommandTransferValue, Command},
status::State,
App,
};
use self::handlers::{command, lua_command, main, matrix, setup}; use self::handlers::{command, lua_command, main, matrix, setup};
@ -34,18 +38,16 @@ impl Event {
.await .await
.with_context(|| format!("Failed to handle lua code: `{}`", lua_code)), .with_context(|| format!("Failed to handle lua code: `{}`", lua_code)),
Event::InputEvent(event) => match app.status.state() { Event::InputEvent(event) => match app.status.state() {
State::Normal => main::handle_normal(app, event) State::Normal => main::handle_normal(app, &event).await.with_context(|| {
.await format!("Failed to handle input (normal) event: `{:#?}`", event)
.with_context(|| format!("Failed to handle input event: `{:#?}`", event)), }),
State::Insert => main::handle_insert(app, event) State::Insert => main::handle_insert(app, &event).await.with_context(|| {
State::Main => main::handle(app, &event) format!("Failed to handle input (insert) event: `{:#?}`", event)
.await }),
.with_context(|| format!("Failed to handle input event: `{:#?}`", event)), State::Setup => setup::handle(app, &event).await.with_context(|| {
State::Setup => setup::handle(app, &event) format!("Failed to handle input (setup) event: `{:#?}`", event)
.await }),
.with_context(|| format!("Failed to handle input event: `{:#?}`", event)),
}, },
} }
} }

View File

@ -151,7 +151,7 @@ impl Status {
}; };
Self { Self {
state: State::None, state: State::Normal,
account_name: "".to_owned(), account_name: "".to_owned(),
account_user_id: "".to_owned(), account_user_id: "".to_owned(),
client, client,

View File

@ -1,7 +1,7 @@
use std::cmp; use std::cmp;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use tui::layout::{Constraint, Direction, Layout}; use tui::{layout::{Constraint, Direction, Layout}, widgets::{Paragraph, Block, Borders}, style::{Style, Color}};
use crate::app::status::Status; use crate::app::status::Status;