fixed form state removed, but not won, aint working yet

This commit is contained in:
Priec
2025-08-22 00:27:23 +02:00
parent 3dd6808ea2
commit 4ed8e7b421
7 changed files with 275 additions and 252 deletions

View File

@@ -15,13 +15,12 @@ impl CommandHandler {
&mut self,
action: &str,
terminal: &mut TerminalCore,
app_state: &AppState,
form_state: &FormState,
app_state: &mut AppState,
login_state: &LoginState,
register_state: &RegisterState,
) -> Result<(bool, String)> {
match action {
"quit" => self.handle_quit(terminal, app_state, form_state, login_state, register_state).await,
"quit" => self.handle_quit(terminal, app_state, login_state, register_state).await,
"force_quit" => self.handle_force_quit(terminal).await,
"save_and_quit" => self.handle_save_quit(terminal).await,
_ => Ok((false, format!("Unknown command: {}", action))),
@@ -31,8 +30,7 @@ impl CommandHandler {
async fn handle_quit(
&self,
terminal: &mut TerminalCore,
app_state: &AppState,
form_state: &FormState,
app_state: &mut AppState,
login_state: &LoginState,
register_state: &RegisterState,
) -> Result<(bool, String)> {
@@ -41,8 +39,10 @@ impl CommandHandler {
login_state.has_unsaved_changes()
} else if app_state.ui.show_register {
register_state.has_unsaved_changes()
} else if let Some(fs) = app_state.form_state_mut() {
fs.has_unsaved_changes
} else {
form_state.has_unsaved_changes
false
};
if !has_unsaved {