From 32d4c7114e31f385561e1492bb14ca22ac1a1406 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Thu, 17 Jul 2025 18:29:04 +0200 Subject: [PATCH] fix(tabs): do not send release event to inactive tab (#4300) * fix(ui): switch left/right in multiple-select to prevent confusion * fix(mouse): do not send release event to inactive pane * docs(changelog): add PR --- CHANGELOG.md | 1 + default-plugins/multiple-select/src/main.rs | 6 +++--- zellij-server/src/tab/mod.rs | 12 +++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bffe11a6..7d6c6987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * fix: slow startup on very large caches (https://github.com/zellij-org/zellij/pull/4292) * fix: don't show popups in the welcome screen (https://github.com/zellij-org/zellij/pull/4294) * fix: reap processes when using an external clipboard tool (https://github.com/zellij-org/zellij/pull/4298) +* fix: out of bounds mouse release events (https://github.com/zellij-org/zellij/pull/4300) ## [0.42.2] - 2025-04-15 * refactor(terminal): track scroll_region as tuple rather than Option (https://github.com/zellij-org/zellij/pull/4082) diff --git a/default-plugins/multiple-select/src/main.rs b/default-plugins/multiple-select/src/main.rs index 6bcd9b9b..8017bb69 100644 --- a/default-plugins/multiple-select/src/main.rs +++ b/default-plugins/multiple-select/src/main.rs @@ -133,10 +133,10 @@ impl App { } fn shortcuts_line2_text() -> (&'static str, Text) { - let text = " - break right, - break left"; + let text = " - break left, - break right"; let component = Text::new(text) - .color_substring(3, "") - .color_substring(3, ""); + .color_substring(3, "") + .color_substring(3, ""); (text, component) } diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 20e87f9d..bf578567 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -4276,7 +4276,17 @@ impl Tab { self.floating_panes .stop_moving_pane_with_mouse(event.position); } else { - self.write_mouse_event_to_active_pane(event, client_id)?; + let active_pane_id = self + .get_active_pane_id(client_id) + .ok_or(anyhow!("Failed to find pane at position"))?; + let pane_id_at_position = self + .get_pane_at(&event.position, false) + .with_context(err_context)? + .ok_or_else(|| anyhow!("Failed to find pane at position"))? + .pid(); + if active_pane_id == pane_id_at_position { + self.write_mouse_event_to_active_pane(event, client_id)?; + } } if leave_clipboard_message { Ok(MouseEffect::leave_clipboard_message())