Skip to content

Commit

Permalink
fix: Some save_prompt_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zaphar committed Mar 4, 2025
1 parent 1604e64 commit 21c4dab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion src/ui/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 21c4dab

Please sign in to comment.