fixing, nothing works lmao

This commit is contained in:
filipriec
2025-04-18 20:48:39 +02:00
parent 5a029283a1
commit d3fcb23e22
18 changed files with 48 additions and 39 deletions

View File

@@ -10,7 +10,7 @@ use crate::tui::terminal::core::TerminalCore;
use crate::tui::functions::common::form::{save, revert};
use crate::modes::handlers::event::EventOutcome;
use crate::tui::functions::common::form::SaveOutcome;
use std::error::Error;
use anyhow::{Context, Result};
pub async fn handle_command_event(
key: KeyEvent,
@@ -26,7 +26,7 @@ pub async fn handle_command_event(
terminal: &mut TerminalCore,
current_position: &mut u64,
total_count: u64,
) -> Result<EventOutcome, Box<dyn Error>> {
) -> Result<EventOutcome> {
// Exit command mode (via configurable keybinding)
if config.is_exit_command_mode(key.code, key.modifiers) {
command_input.clear();
@@ -84,7 +84,7 @@ async fn process_command(
terminal: &mut TerminalCore,
current_position: &mut u64,
total_count: u64,
) -> Result<EventOutcome, Box<dyn Error>> {
) -> Result<EventOutcome> {
// Clone the trimmed command to avoid borrow issues
let command = command_input.trim().to_string();
if command.is_empty() {

View File

@@ -3,6 +3,7 @@ use crate::tui::terminal::core::TerminalCore;
use crate::state::app::state::AppState;
use crate::state::pages::{form::FormState, auth::LoginState, auth::RegisterState};
use crate::state::pages::canvas_state::CanvasState;
use anyhow::{Context, Result};
pub struct CommandHandler;
@@ -19,7 +20,7 @@ impl CommandHandler {
form_state: &FormState,
login_state: &LoginState,
register_state: &RegisterState,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
) -> Result<(bool, String)> {
match action {
"quit" => self.handle_quit(terminal, app_state, form_state, login_state, register_state).await,
"force_quit" => self.handle_force_quit(terminal).await,
@@ -35,7 +36,7 @@ impl CommandHandler {
form_state: &FormState,
login_state: &LoginState,
register_state: &RegisterState,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
) -> Result<(bool, String)> {
// Use actual unsaved changes state instead of is_saved flag
let has_unsaved = if app_state.ui.show_login {
login_state.has_unsaved_changes()
@@ -56,7 +57,7 @@ impl CommandHandler {
async fn handle_force_quit(
&self,
terminal: &mut TerminalCore,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
) -> Result<(bool, String)> {
terminal.cleanup()?;
Ok((true, "Force exiting without saving.".into()))
}
@@ -64,7 +65,7 @@ impl CommandHandler {
async fn handle_save_quit(
&mut self,
terminal: &mut TerminalCore,
) -> Result<(bool, String), Box<dyn std::error::Error>> {
) -> Result<(bool, String)> {
terminal.cleanup()?;
Ok((true, "State saved. Exiting.".into()))
}