added save confirmation, changed exit dialog

This commit is contained in:
Phani Pavan K
2025-11-10 14:19:58 +05:30
parent 1aea9c4930
commit 059415dca2
6 changed files with 51 additions and 9 deletions

View File

@@ -84,10 +84,7 @@ fn runApp<B: Backend>(app: &mut AppState, terminal: &mut Terminal<B>) -> Result<
}
KeyCode::Char('s') => {
if app.isHashDifferent() {
app.saveConfigToScript();
app.saveConfigToSettingsFile();
app.appStatus = AppStatus::Saved;
terminal.clear()?;
app.screen = CurrentScreen::SaveConfirm;
}
}
KeyCode::F(2) => app.screen = CurrentScreen::Settings,
@@ -184,6 +181,17 @@ fn runApp<B: Backend>(app: &mut AppState, terminal: &mut Terminal<B>) -> Result<
}
_ => {}
},
CurrentScreen::SaveConfirm => match key.code {
KeyCode::Enter => {
app.saveConfigToScript();
app.saveConfigToSettingsFile();
app.appStatus = AppStatus::Saved;
terminal.clear()?;
app.screen = CurrentScreen::Main;
}
KeyCode::Esc => app.screen = CurrentScreen::Main,
_ => {}
},
CurrentScreen::Exit => match key.code {
KeyCode::Enter => {
// app.saveConfigToSettingsFile();