diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-08 16:26:47 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-08 16:26:47 +0300 |
| commit | 10974c822d607f03e20e9741ec027910f0c1f93a (patch) | |
| tree | 85453f5ba5bcfcc56c37cabdbbced8a7e701cbe3 /src/app/input/modal.rs | |
| parent | 1d6d1fdc6ba8a4fd0385a2071f157504871201a2 (diff) | |
feat(input): add per-pane right-click routing (#2504)
Diffstat (limited to 'src/app/input/modal.rs')
| -rw-r--r-- | src/app/input/modal.rs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/app/input/modal.rs b/src/app/input/modal.rs index 0a5c13e5..7a9ffe46 100644 --- a/src/app/input/modal.rs +++ b/src/app/input/modal.rs @@ -1288,6 +1288,27 @@ impl App { } ( ContextMenuKind::Pane { + ws_idx, pane_id, .. + }, + Some(action @ ("Send right-clicks to pane" | "Use Herdr right-click menu")), + ) => { + if let Some(pane_id) = self.public_pane_id(ws_idx, pane_id) { + self.runtime_pane_input_set( + "tui.pane.input.set", + crate::api::schema::PaneInputSetParams { + pane_id, + right_click: if action == "Send right-clicks to pane" { + crate::api::schema::PaneRightClickTarget::Pane + } else { + crate::api::schema::PaneRightClickTarget::Herdr + }, + }, + ); + } + self.state.mode = Mode::Terminal; + } + ( + ContextMenuKind::Pane { ws_idx, pane_id, source_pane_id: Some(source_pane_id), @@ -2180,6 +2201,39 @@ mod tests { } #[test] + fn context_menu_toggles_pane_right_click_passthrough() { + let mut app = app_with_test_workspaces(&["main"]); + app.state.active = Some(0); + let pane_id = app.state.workspaces[0].tabs[0].root_pane; + let menu = ContextMenuState { + kind: ContextMenuKind::Pane { + ws_idx: 0, + tab_idx: 0, + pane_id, + source_pane_id: None, + has_manual_label: false, + right_click_passthrough: false, + }, + x: 0, + y: 0, + list: MenuListState::new(0), + }; + let idx = menu + .items() + .iter() + .position(|item| *item == "Send right-clicks to pane") + .unwrap(); + app.apply_context_menu_action_via_api(menu, idx); + + assert!( + app.state.workspaces[0] + .pane_state(pane_id) + .unwrap() + .right_click_passthrough + ); + } + + #[test] fn context_menu_close_pane_last_parent_group_pane_keeps_confirmation_mode() { let mut state = state_with_workspaces(&["main", "issue"]); state.active = Some(0); @@ -2206,6 +2260,7 @@ mod tests { pane_id, source_pane_id: None, has_manual_label: false, + right_click_passthrough: false, }, x: 0, y: 0, @@ -2271,6 +2326,7 @@ mod tests { pane_id, source_pane_id: None, has_manual_label: false, + right_click_passthrough: false, }, x: 0, y: 0, |
