summaryrefslogtreecommitdiffstats
path: root/src/verb
diff options
context:
space:
mode:
authorDenys Séguret <cano.petrole@gmail.com>2022-10-22 19:05:03 +0200
committerGitHub <noreply@github.com>2022-10-22 19:05:03 +0200
commit002f8d1f7296064ea89a893ca7fe201e6fd54983 (patch)
treecd0bebbe658acc81e69c1170b0c4f1c72074e652 /src/verb
parente0b63e5008ae51acb68c6628d63c1d2307abf526 (diff)
restrict verbs to specific panels (#620)
Diffstat (limited to 'src/verb')
-rw-r--r--src/verb/verb.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/verb/verb.rs b/src/verb/verb.rs
index 60b14d1..55aba13 100644
--- a/src/verb/verb.rs
+++ b/src/verb/verb.rs
@@ -71,7 +71,9 @@ pub struct Verb {
/// whether to show the verb in help screen
/// (if we show all input related actions, the doc is unusable)
- pub show_in_doc: bool
+ pub show_in_doc: bool,
+
+ pub panels: Vec<PanelStateType>,
}
impl PartialEq for Verb {
@@ -122,6 +124,7 @@ impl Verb {
needs_another_panel,
auto_exec: true,
show_in_doc: true,
+ panels: Vec::new(),
})
}
fn update_key_desc(&mut self) {
@@ -295,4 +298,8 @@ impl Verb {
pub fn is_sequence(&self) -> bool {
matches!(self.execution, VerbExecution::Sequence(_))
}
+
+ pub fn can_be_called_in_panel(&self, panel_state_type: PanelStateType) -> bool {
+ self.panels.is_empty() || self.panels.contains(&panel_state_type)
+ }
}