1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

add swallow_mouse_click_on_pane_focus option

refs: https://github.com/wez/wezterm/issues/724
This commit is contained in:
Wez Furlong 2021-04-23 21:45:47 -07:00
parent f97df9307a
commit 657ed92d82
4 changed files with 19 additions and 1 deletions

View File

@ -1064,6 +1064,9 @@ pub struct Config {
#[serde(default)]
pub sort_fallback_fonts_by_coverage: bool,
#[serde(default)]
pub swallow_mouse_click_on_pane_focus: bool,
}
impl_lua_conversion!(Config);

View File

@ -33,6 +33,7 @@ As features stabilize some brief notes about them will accumulate here.
* Fixed: key and mouse assignments set via [window:set_config_overrides](config/lua/window/set_config_overrides.md) were not respected. [#656](https://github.com/wez/wezterm/issues/656)
* Fixed: potential panic when word selecting off top of viewport [#713](https://github.com/wez/wezterm/issues/713)
* Fixed: really long busy wait when displaying single logical json line of 1.5MB in length [#714](https://github.com/wez/wezterm/issues/714)
* New: [swallow_mouse_click_on_pane_focus](config/lua/config/swallow_mouse_click_on_pane_focus.md) option [#724](https://github.com/wez/wezterm/issues/724)
### 20210405-110924-a5bb5be8

View File

@ -0,0 +1,10 @@
# `swallow_mouse_click_on_pane_focus = false`
*Since: nightly builds only*
When set to `true`, clicking on a pane will focus it.
When set to `false` (the default), clicking on a pane will focus it and then
pass the click through to the application in the terminal.

View File

@ -287,6 +287,7 @@ impl super::TermWindow {
context: &dyn WindowOps,
) {
let mut on_split = None;
let mut is_click_to_focus = false;
if y >= 0 {
let y = y as usize;
@ -337,6 +338,7 @@ impl super::TermWindow {
.map(|tab| tab.set_active_idx(pos.index));
pane = Rc::clone(&pos.pane);
is_click_to_focus = true;
}
WMEK::Move => {}
WMEK::Release(_) => {}
@ -503,7 +505,9 @@ impl super::TermWindow {
modifiers: window_mods_to_termwiz_mods(event.modifiers),
};
pane.mouse_event(mouse_event).ok();
if !(self.config.swallow_mouse_click_on_pane_focus && is_click_to_focus) {
pane.mouse_event(mouse_event).ok();
}
match event.kind {
WMEK::Move => {}