From 84c13fd6f8de3c22a09107de67f20651fd70bd9d Mon Sep 17 00:00:00 2001 From: Soispha Date: Wed, 26 Jul 2023 22:25:08 +0200 Subject: [PATCH] Fix(treewide): Resolve merge conflicts --- .../event_types/event/handlers/command.rs | 14 +++++----- .../events/event_types/event/handlers/main.rs | 2 +- src/app/events/event_types/event/mod.rs | 26 ++++++++++--------- src/app/status.rs | 2 +- src/ui/central/update/mod.rs | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/app/events/event_types/event/handlers/command.rs b/src/app/events/event_types/event/handlers/command.rs index 69c43e1..de301f9 100644 --- a/src/app/events/event_types/event/handlers/command.rs +++ b/src/app/events/event_types/event/handlers/command.rs @@ -4,14 +4,14 @@ use anyhow::{Error, Result}; use cli_log::{trace, warn}; use tokio::sync::oneshot; -use crate::app::{ +use crate::{app::{ command_interface::{ lua_command_manager::{CommandTransferValue, Table}, Command, }, events::event_types::EventStatus, - App, -}; + App, status::State, +}, ui::central::InputPosition}; pub async fn handle( app: &mut App<'_>, @@ -99,14 +99,14 @@ pub async fn handle( Command::SetModeNormal => { app.status.set_state(State::Normal); - set_status_output!("Set input mode to Normal"); - (EventStatus::Ok, "".to_owned()) + send_status_output!("Set input mode to Normal"); + EventStatus::Ok } Command::SetModeInsert => { app.status.set_state(State::Insert); app.ui.set_input_position(InputPosition::MessageCompose); - set_status_output!("Set input mode to Insert"); - (EventStatus::Ok, "".to_owned()) + send_status_output!("Set input mode to Insert"); + EventStatus::Ok } Command::RoomMessageSend(msg) => { diff --git a/src/app/events/event_types/event/handlers/main.rs b/src/app/events/event_types/event/handlers/main.rs index 4462257..6ddcce5 100644 --- a/src/app/events/event_types/event/handlers/main.rs +++ b/src/app/events/event_types/event/handlers/main.rs @@ -10,7 +10,7 @@ use crate::{ ui::central, }; -pub async fn handle( +pub async fn handle_normal( app: &mut App<'_>, input_event: &CrosstermEvent, ) -> Result { diff --git a/src/app/events/event_types/event/mod.rs b/src/app/events/event_types/event/mod.rs index 2917519..27bba87 100644 --- a/src/app/events/event_types/event/mod.rs +++ b/src/app/events/event_types/event/mod.rs @@ -5,7 +5,11 @@ use cli_log::trace; use crossterm::event::Event as CrosstermEvent; 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}; @@ -34,18 +38,16 @@ impl Event { .await .with_context(|| format!("Failed to handle lua code: `{}`", lua_code)), - Event::InputEvent(event) => match app.status.state() { - State::Normal => main::handle_normal(app, event) - .await - .with_context(|| format!("Failed to handle input event: `{:#?}`", event)), - State::Insert => main::handle_insert(app, event) - State::Main => main::handle(app, &event) - .await - .with_context(|| format!("Failed to handle input event: `{:#?}`", event)), - State::Setup => setup::handle(app, &event) - .await - .with_context(|| format!("Failed to handle input event: `{:#?}`", event)), + State::Normal => main::handle_normal(app, &event).await.with_context(|| { + format!("Failed to handle input (normal) event: `{:#?}`", event) + }), + State::Insert => main::handle_insert(app, &event).await.with_context(|| { + format!("Failed to handle input (insert) event: `{:#?}`", event) + }), + State::Setup => setup::handle(app, &event).await.with_context(|| { + format!("Failed to handle input (setup) event: `{:#?}`", event) + }), }, } } diff --git a/src/app/status.rs b/src/app/status.rs index 770249a..9ce211c 100644 --- a/src/app/status.rs +++ b/src/app/status.rs @@ -151,7 +151,7 @@ impl Status { }; Self { - state: State::None, + state: State::Normal, account_name: "".to_owned(), account_user_id: "".to_owned(), client, diff --git a/src/ui/central/update/mod.rs b/src/ui/central/update/mod.rs index 67cfb31..fcd06b0 100644 --- a/src/ui/central/update/mod.rs +++ b/src/ui/central/update/mod.rs @@ -1,7 +1,7 @@ use std::cmp; 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;