fix: Some save_prompt_fixes

This commit is contained in:
Jeremy Wall 2025-03-04 18:54:28 -05:00
parent 1604e6484d
commit 21c4dab5f4
2 changed files with 5 additions and 2 deletions

View File

@ -332,10 +332,14 @@ impl<'ws> Workspace<'ws> {
fn handle_quit_dialog(&mut self, key: event::KeyEvent) -> Result<Option<ExitCode>> {
if key.kind == KeyEventKind::Press {
match key.code {
KeyCode::Esc | KeyCode::Char('n') | KeyCode::Char('N') => return Ok(Some(ExitCode::SUCCESS)),
KeyCode::Esc | KeyCode::Char('n') | KeyCode::Char('N') => {
self.exit_quit_mode()?;
return Ok(Some(ExitCode::SUCCESS))
},
KeyCode::Char('y') | KeyCode::Char('Y') => {
// We have been asked to save the file first.
self.save_file()?;
self.exit_quit_mode()?;
return Ok(Some(ExitCode::SUCCESS));
},
_ => return Ok(None),

View File

@ -1333,7 +1333,6 @@ fn test_quit_dialog() {
.expect("Failed to run input script");
assert!(!result.is_some());
assert_eq!(ws.state.modality(), &Modality::Quit);
assert!(result.is_some());
script()
.char('n')