fix(configuration): leave notification up when base mode changes (#3696)

This commit is contained in:
Aram Drevekenin 2024-10-24 10:16:30 +02:00 committed by GitHub
parent c28dbe8c28
commit a71b18327a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View file

@ -32,8 +32,16 @@ impl Screen {
Screen::new_reset_keybindings_screen(Some(0));
} else {
match self {
Screen::RebindLeaders(r) => *r = Default::default(),
Screen::Presets(r) => *r = Default::default(),
Screen::RebindLeaders(r) => {
let notification = r.drain_notification();
*r = Default::default();
r.set_notification(notification);
},
Screen::Presets(r) => {
let notification = r.drain_notification();
*r = Default::default();
r.set_notification(notification);
},
}
}
}

View file

@ -190,6 +190,12 @@ impl PresetsScreen {
pub fn reset_selected_index(&mut self) {
self.selected_index = Some(0);
}
pub fn drain_notification(&mut self) -> Option<String> {
self.notification.take()
}
pub fn set_notification(&mut self, notification: Option<String>) {
self.notification = notification;
}
fn reconfigure(&self, selected: usize, write_to_disk: bool) {
if selected == 0 {
// TODO: these should be part of a "transaction" when they are

View file

@ -680,6 +680,12 @@ impl RebindLeadersScreen {
self.handle_default_preset_key(key)
}
}
pub fn drain_notification(&mut self) -> Option<String> {
self.notification.take()
}
pub fn set_notification(&mut self, notification: Option<String>) {
self.notification = notification;
}
fn currently_in_unlock_first(&self) -> bool {
if self.is_rebinding_for_presets {
false