diff options
author | Denys Séguret <cano.petrole@gmail.com> | 2022-10-22 19:05:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 19:05:03 +0200 |
commit | 002f8d1f7296064ea89a893ca7fe201e6fd54983 (patch) | |
tree | cd0bebbe658acc81e69c1170b0c4f1c72074e652 /src/command | |
parent | e0b63e5008ae51acb68c6628d63c1d2307abf526 (diff) |
restrict verbs to specific panels (#620)
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/panel_input.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/command/panel_input.rs b/src/command/panel_input.rs index 604c34a..c49244f 100644 --- a/src/command/panel_input.rs +++ b/src/command/panel_input.rs @@ -74,6 +74,7 @@ impl PanelInput { /// - maybe change the input /// - build a command /// then redraw the input field + #[allow(clippy::too_many_arguments)] pub fn on_event( &mut self, w: &mut W, @@ -82,8 +83,9 @@ impl PanelInput { sel_info: SelInfo<'_>, app_state: &AppState, mode: Mode, + panel_state_type: PanelStateType, ) -> Result<Command, ProgramError> { - let cmd = self.get_command(event, con, sel_info, app_state, mode); + let cmd = self.get_command(event, con, sel_info, app_state, mode, panel_state_type); self.input_field.display_on(w)?; Ok(cmd) } @@ -187,6 +189,7 @@ impl PanelInput { sel_info: SelInfo<'_>, app_state: &AppState, mode: Mode, + panel_state_type: PanelStateType, ) -> Command { match timed_event.event { Event::Mouse(MouseEvent { kind, column, row, modifiers: KeyModifiers::NONE }) => { @@ -325,6 +328,9 @@ impl PanelInput { if !verb.selection_condition.is_respected_by(sel_info.common_stype()) { continue; } + if !verb.can_be_called_in_panel(panel_state_type) { + continue; + } if mode != Mode::Input && verb.is_internal(Internal::mode_input) { self.enter_input_mode_with_key(key, &parts); } |