Skip to content

Commit

Permalink
fix enter on locked device
Browse files Browse the repository at this point in the history
  • Loading branch information
zd4y committed Mar 30, 2024
1 parent 71cdb44 commit ccb8314
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct App {
reading_passphrase: bool,
state_msg: Option<String>,
exit: bool,
exit_after_passphrase: bool,
exit_mount_point: Option<String>,
print_on_exit: bool,
runtime: Runtime,
Expand Down Expand Up @@ -77,6 +78,7 @@ impl App {
reading_passphrase: false,
state_msg: None,
exit: false,
exit_after_passphrase: false,
exit_mount_point: None,
print_on_exit: false,
runtime,
Expand Down Expand Up @@ -111,6 +113,10 @@ impl App {
}
}

if !self.exit {
return self.run(terminal);
}

Ok(())
}

Expand Down Expand Up @@ -158,6 +164,10 @@ impl App {
KeyCode::Enter => {
self.reading_passphrase = false;
self.mount()?;
if self.exit_after_passphrase {
self.exit = true;
self.exit_after_passphrase = false;
}
}
KeyCode::Backspace => {
passphrase.pop();
Expand Down Expand Up @@ -296,6 +306,10 @@ impl App {
Message::PassphraseRequired(idx) => {
self.reading_passphrase = true;
self.selected_device_index = idx;
if self.exit {
self.exit_after_passphrase = true;
}
self.exit = false;
Ok(())
}
}
Expand Down Expand Up @@ -346,6 +360,7 @@ impl App {
self.reading_passphrase = false;
self.state_msg = None;
self.exit = false;
self.exit_after_passphrase = false;
self.exit_mount_point = None;
self.print_on_exit = false;
self.get_or_refresh_devices();
Expand Down

0 comments on commit ccb8314

Please sign in to comment.