diff --git a/config/src/lib.rs b/config/src/lib.rs index a6968fa7d..fd752ca53 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -1235,6 +1235,9 @@ pub struct Config { #[serde(default)] pub pane_focus_follows_mouse: bool, + #[serde(default = "default_true")] + pub unzoom_on_switch_pane: bool, + #[serde(default = "default_max_fps")] pub max_fps: u8, diff --git a/docs/config/lua/config/unzoom_on_switch_pane.md b/docs/config/lua/config/unzoom_on_switch_pane.md new file mode 100644 index 000000000..41bb808bb --- /dev/null +++ b/docs/config/lua/config/unzoom_on_switch_pane.md @@ -0,0 +1,11 @@ +# `unzoom_on_switch_pane = true` + +*Since: nightly builds only* + +If set to `false`, the +[`ActivatePaneDirection`](../keyassignment/ActivatePaneDirection.md) command +will have no effect if the active pane is zoomed. + +If `true`, the active pane will be unzoomed first and then switched. + +See also: [`TogglePaneZoomState`](../keyassignment/TogglePaneZoomState.md) diff --git a/docs/config/lua/keyassignment/ActivatePaneDirection.md b/docs/config/lua/keyassignment/ActivatePaneDirection.md index 8d6dd0022..f68ae6c1c 100644 --- a/docs/config/lua/keyassignment/ActivatePaneDirection.md +++ b/docs/config/lua/keyassignment/ActivatePaneDirection.md @@ -6,6 +6,9 @@ In cases where there are multiple adjacent panes in the intended direction, wezterm will choose the pane that has the largest edge intersection. +If the active pane is [zoomed](TogglePaneZoomState.md), behavior is determined +by the [`unzoom_on_switch_pane`](../config/unzoom_on_switch_pane.md) flag. + ```lua local wezterm = require 'wezterm'; diff --git a/docs/config/lua/keyassignment/TogglePaneZoomState.md b/docs/config/lua/keyassignment/TogglePaneZoomState.md index b787a62fe..9c750b160 100644 --- a/docs/config/lua/keyassignment/TogglePaneZoomState.md +++ b/docs/config/lua/keyassignment/TogglePaneZoomState.md @@ -13,3 +13,5 @@ return { } } ``` + +See also: [`unzoom_on_switch_pane`](../config/unzoom_on_switch_pane.md) diff --git a/mux/src/tab.rs b/mux/src/tab.rs index a24c862fb..f1256a361 100644 --- a/mux/src/tab.rs +++ b/mux/src/tab.rs @@ -2,6 +2,7 @@ use crate::domain::DomainId; use crate::pane::*; use crate::{Mux, WindowId}; use bintree::PathBranch; +use config::configuration; use config::keyassignment::PaneDirection; use portable_pty::PtySize; use rangeset::range_intersection; @@ -1038,7 +1039,10 @@ impl Tab { /// edge intersection. pub fn activate_pane_direction(&self, direction: PaneDirection) { if self.zoomed.borrow().is_some() { - return; + if !configuration().unzoom_on_switch_pane { + return; + } + self.toggle_zoom(); } let panes = self.iter_panes();