fixed and now fully functional
This commit is contained in:
@@ -4,6 +4,7 @@ use crossterm::event::{KeyEvent, KeyCode, KeyModifiers};
|
|||||||
use crate::config::binds::config::Config;
|
use crate::config::binds::config::Config;
|
||||||
use crate::services::grpc_client::GrpcClient;
|
use crate::services::grpc_client::GrpcClient;
|
||||||
use crate::state::pages::form::FormState;
|
use crate::state::pages::form::FormState;
|
||||||
|
use crate::state::{state::AppState, pages::auth::AuthState};
|
||||||
use crate::modes::common::commands::CommandHandler;
|
use crate::modes::common::commands::CommandHandler;
|
||||||
use crate::tui::terminal::core::TerminalCore;
|
use crate::tui::terminal::core::TerminalCore;
|
||||||
use crate::tui::functions::common::form::{save, revert};
|
use crate::tui::functions::common::form::{save, revert};
|
||||||
@@ -14,6 +15,8 @@ use std::error::Error;
|
|||||||
pub async fn handle_command_event(
|
pub async fn handle_command_event(
|
||||||
key: KeyEvent,
|
key: KeyEvent,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
app_state: &AppState,
|
||||||
|
auth_state: &AuthState,
|
||||||
form_state: &mut FormState,
|
form_state: &mut FormState,
|
||||||
command_input: &mut String,
|
command_input: &mut String,
|
||||||
command_message: &mut String,
|
command_message: &mut String,
|
||||||
@@ -35,6 +38,8 @@ pub async fn handle_command_event(
|
|||||||
return process_command(
|
return process_command(
|
||||||
config,
|
config,
|
||||||
form_state,
|
form_state,
|
||||||
|
app_state,
|
||||||
|
auth_state,
|
||||||
command_input,
|
command_input,
|
||||||
command_message,
|
command_message,
|
||||||
grpc_client,
|
grpc_client,
|
||||||
@@ -67,6 +72,8 @@ pub async fn handle_command_event(
|
|||||||
async fn process_command(
|
async fn process_command(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
form_state: &mut FormState,
|
form_state: &mut FormState,
|
||||||
|
app_state: &AppState,
|
||||||
|
auth_state: &AuthState,
|
||||||
command_input: &mut String,
|
command_input: &mut String,
|
||||||
command_message: &mut String,
|
command_message: &mut String,
|
||||||
grpc_client: &mut GrpcClient,
|
grpc_client: &mut GrpcClient,
|
||||||
@@ -89,7 +96,13 @@ async fn process_command(
|
|||||||
match action {
|
match action {
|
||||||
"force_quit" | "save_and_quit" | "quit" => {
|
"force_quit" | "save_and_quit" | "quit" => {
|
||||||
let (should_exit, message) = command_handler
|
let (should_exit, message) = command_handler
|
||||||
.handle_command(action, terminal)
|
.handle_command(
|
||||||
|
action,
|
||||||
|
terminal,
|
||||||
|
app_state,
|
||||||
|
form_state,
|
||||||
|
auth_state,
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
command_input.clear();
|
command_input.clear();
|
||||||
if should_exit {
|
if should_exit {
|
||||||
|
|||||||
@@ -268,6 +268,8 @@ impl EventHandler {
|
|||||||
let outcome = command_mode::handle_command_event(
|
let outcome = command_mode::handle_command_event(
|
||||||
key,
|
key,
|
||||||
config,
|
config,
|
||||||
|
app_state,
|
||||||
|
auth_state,
|
||||||
form_state,
|
form_state,
|
||||||
&mut self.command_input,
|
&mut self.command_input,
|
||||||
&mut self.command_message,
|
&mut self.command_message,
|
||||||
|
|||||||
Reference in New Issue
Block a user