Add ModifiersChanged message on Tab and keep value

The message is forwarded from app/dialog Message, and used to
keep the value of the status of modifiers in Tab.
This commit is contained in:
Gwen Lg 2025-03-26 00:23:41 +01:00
parent d8a198e836
commit e220268954
3 changed files with 14 additions and 0 deletions

View file

@ -2629,6 +2629,11 @@ impl Application for App {
},
Message::ModifiersChanged(modifiers) => {
self.modifiers = modifiers;
let entity = self.tab_model.active();
return self.update(Message::TabMessage(
Some(entity),
tab::Message::ModifiersChanged(modifiers),
));
}
Message::MounterItems(mounter_key, mounter_items) => {
// Check for unmounted folders

View file

@ -1292,6 +1292,9 @@ impl Application for App {
}
Message::ModifiersChanged(modifiers) => {
self.modifiers = modifiers;
return self.update(Message::TabMessage(tab::Message::ModifiersChanged(
modifiers,
)));
}
Message::MounterItems(mounter_key, mounter_items) => {
// Check for unmounted folders

View file

@ -1257,6 +1257,7 @@ pub enum Message {
ItemUp,
Location(Location),
LocationUp,
ModifiersChanged(Modifiers),
Open(Option<PathBuf>),
RightClick(Option<usize>),
MiddleClick(usize),
@ -1898,6 +1899,7 @@ pub struct Tab {
select_range: Option<(usize, usize)>,
clicked: Option<usize>,
selected_clicked: bool,
modifiers: Modifiers,
last_right_click: Option<usize>,
search_context: Option<SearchContext>,
global_cursor_position: Option<Point>,
@ -1994,6 +1996,7 @@ impl Tab {
clicked: None,
dnd_hovered: None,
selected_clicked: false,
modifiers: Modifiers::default(),
last_right_click: None,
search_context: None,
global_cursor_position: None,
@ -3034,6 +3037,9 @@ impl Tab {
}
}
}
Message::ModifiersChanged(modifiers) => {
self.modifiers = modifiers;
}
Message::Open(path_opt) => {
match path_opt {
Some(path) => {