Skip to content

Commit

Permalink
fix(configuration): leave notification up when base mode changes (zel…
Browse files Browse the repository at this point in the history
  • Loading branch information
imsnif authored and Tomcat-42 committed Nov 9, 2024
1 parent 2014a2c commit 5e94dba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
12 changes: 10 additions & 2 deletions default-plugins/configuration/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions default-plugins/configuration/src/presets_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions default-plugins/configuration/src/rebind_leaders_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e94dba

Please sign in to comment.