Repository: alacritty/alacritty
File: alacritty/src/input.rs (Rust)

Code before:

        // If mouse mode is active, also look for bindings without Shift
        let mut fallback_needed = mouse_mode && mods.contains(ModifiersState::SHIFT);

        for binding in &mouse_bindings {
            if binding.is_triggered_by(mode, mods, &button) {
                fallback_needed = false;
                binding.action.execute(&mut self.ctx);
            }
        }

        if fallback_needed {
            let fallback_mods = mods & !ModifiersState::SHIFT;
            for binding in &mouse_bindings {
                if binding.is_triggered_by(mode, fallback_mods, &button) {
                    binding.action.execute(&mut self.ctx);
                }
            }
        }
    }

    /// Process key input.
    pub fn key_input(&mut self, key: KeyEvent) {
        // IME input will be applied on commit and shouldn't trigger key bindings.
        if key.state == ElementState::Released || self.ctx.display().ime.preedit().is_some() {
            return;
        }

        let text = key.text_with_all_modifiers().unwrap_or_default();

        // All key bindings are disabled while a hint is being selected.
        if self.ctx.display().hint_state.active() {
            for character in text.chars() {
                self.ctx.hint_input(character);
            }
            return;
        }

        // Reset search delay when the user is still typing.
        if self.ctx.search_active() {
            let timer_id = TimerId::new(Topic::DelayedSearch, self.ctx.window().id());
            let scheduler = self.ctx.scheduler_mut();
            if let Some(timer) = scheduler.unschedule(timer_id) {
                scheduler.schedule(timer.event, TYPING_SEARCH_DELAY, false, timer.id);
            }
        }

        // Key bindings suppress the character input.
        if self.process_key_bindings(&key) {
            return;
        }

Review comment (suggestion):
```suggestion
                binding.action.execute(&mut self.ctx);
                fallback_needed = false;
```

Code after:
                ElementState::Pressed => {
                    // Process mouse press before bindings to update the `click_state`.
                    self.on_mouse_press(button);
                    self.process_mouse_bindings(button);
                },
                ElementState::Released => self.on_mouse_release(button),
            }
        }
    }

    /// Attempt to find a binding and execute its action.
    ///
    /// The provided mode, mods, and key must match what is allowed by a binding
    /// for its action to be executed.
    fn process_mouse_bindings(&mut self, button: MouseButton) {
        let mode = BindingMode::new(self.ctx.terminal().mode(), self.ctx.search_active());
        let mouse_mode = self.ctx.mouse_mode();
        let mods = self.ctx.modifiers().state();
        let mouse_bindings = self.ctx.config().mouse_bindings().to_owned();

        // If mouse mode is active, also look for bindings without shift.
        let mut check_fallback = mouse_mode && mods.contains(ModifiersState::SHIFT);

        for binding in &mouse_bindings {
            if binding.is_triggered_by(mode, mods, &button) {
                binding.action.execute(&mut self.ctx);
                check_fallback = false;
            }
        }

        if check_fallback {
            let fallback_mods = mods & !ModifiersState::SHIFT;
            for binding in &mouse_bindings {
                if binding.is_triggered_by(mode, fallback_mods, &button) {
                    binding.action.execute(&mut self.ctx);
                }
            }
        }
    }

    /// Process key input.
    pub fn key_input(&mut self, key: KeyEvent) {
        // IME input will be applied on commit and shouldn't trigger key bindings.
        if key.state == ElementState::Released || self.ctx.display().ime.preedit().is_some() {
            return;
        }

        let text = key.text_with_all_modifiers().unwrap_or_default();

        // All key bindings are disabled while a hint is being selected.
        if self.ctx.display().hint_state.active() {