mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-23 05:19:48 -04:00
fix: Some save_prompt_fixes
This commit is contained in:
parent
1604e6484d
commit
21c4dab5f4
@ -332,10 +332,14 @@ impl<'ws> Workspace<'ws> {
|
|||||||
fn handle_quit_dialog(&mut self, key: event::KeyEvent) -> Result<Option<ExitCode>> {
|
fn handle_quit_dialog(&mut self, key: event::KeyEvent) -> Result<Option<ExitCode>> {
|
||||||
if key.kind == KeyEventKind::Press {
|
if key.kind == KeyEventKind::Press {
|
||||||
match key.code {
|
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') => {
|
KeyCode::Char('y') | KeyCode::Char('Y') => {
|
||||||
// We have been asked to save the file first.
|
// We have been asked to save the file first.
|
||||||
self.save_file()?;
|
self.save_file()?;
|
||||||
|
self.exit_quit_mode()?;
|
||||||
return Ok(Some(ExitCode::SUCCESS));
|
return Ok(Some(ExitCode::SUCCESS));
|
||||||
},
|
},
|
||||||
_ => return Ok(None),
|
_ => return Ok(None),
|
||||||
|
@ -1333,7 +1333,6 @@ fn test_quit_dialog() {
|
|||||||
.expect("Failed to run input script");
|
.expect("Failed to run input script");
|
||||||
assert!(!result.is_some());
|
assert!(!result.is_some());
|
||||||
assert_eq!(ws.state.modality(), &Modality::Quit);
|
assert_eq!(ws.state.modality(), &Modality::Quit);
|
||||||
assert!(result.is_some());
|
|
||||||
|
|
||||||
script()
|
script()
|
||||||
.char('n')
|
.char('n')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user