Set lowest priority to shortcut command UIEvents
Commit (a37d5fc1
conf/shortcuts: implement
a key to command mapping) introduced shortcuts that expand to user
defined commands. To allow already existing shortcuts to take
precedence, the check for the user-defined shortcuts should be the last
one in the evaluation order.
Example problem scenario:
- Press new_mail shortcut (e.g. `m`)
- Code in listing.rs searches if it matches any of the commands, and
regardless if it matches or not, stops the evaluation and returns.
- New mail composer never shows up.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/348/head
parent
5afc078587
commit
1eca34b398
|
@ -838,8 +838,8 @@ impl Component for ContactList {
|
|||
self.movement = Some(PageMovement::End);
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.contact_list
|
||||
|
@ -853,7 +853,9 @@ impl Component for ContactList {
|
|||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
@ -1132,23 +1132,6 @@ impl Component for Composer {
|
|||
};
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
.settings
|
||||
.shortcuts
|
||||
.composing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if self.cursor == Cursor::Headers
|
||||
|
@ -2197,6 +2180,25 @@ impl Component for Composer {
|
|||
}
|
||||
_ => {}
|
||||
},
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.composing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
false
|
||||
|
|
|
@ -1960,25 +1960,6 @@ impl Component for Listing {
|
|||
)));
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
.settings
|
||||
.shortcuts
|
||||
.listing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -2441,6 +2422,25 @@ impl Component for Listing {
|
|||
)));
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.listing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
false
|
||||
|
|
|
@ -1415,23 +1415,6 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
_ => {}
|
||||
},
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
.settings
|
||||
.shortcuts
|
||||
.listing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -1516,6 +1499,25 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
self.set_dirty(true);
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.listing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -789,8 +789,8 @@ impl Component for MailView {
|
|||
.push_back(UIEvent::Action(Tab(New(Some(Box::new(new_tab))))));
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.envelope_view
|
||||
|
@ -804,7 +804,9 @@ impl Component for MailView {
|
|||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
@ -1103,8 +1103,8 @@ impl Component for ThreadView {
|
|||
}
|
||||
false
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.thread_view
|
||||
|
@ -1118,9 +1118,13 @@ impl Component for ThreadView {
|
|||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}) =>
|
||||
{
|
||||
true
|
||||
}
|
||||
_ => {
|
||||
// [ref:VERIFY]: In what case do we need to forward a handled UIEvent to all
|
||||
// entries?
|
||||
if self
|
||||
.entries
|
||||
.iter_mut()
|
||||
|
|
|
@ -835,8 +835,8 @@ impl Component for Pager {
|
|||
String::new(),
|
||||
)));
|
||||
}
|
||||
UIEvent::Input(ref key) => {
|
||||
return context.settings.shortcuts.pager.commands.iter().any(|cmd| {
|
||||
UIEvent::Input(ref key)
|
||||
if context.settings.shortcuts.pager.commands.iter().any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
|
@ -844,7 +844,9 @@ impl Component for Pager {
|
|||
return true;
|
||||
}
|
||||
false
|
||||
})
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue