added save confirmation, changed exit dialog
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user