Unzoom when switching panes (#1301)

* mux: unzoom when switching panes

Add `unzoom_on_switch_pane` config option:

When switching to another pane with ActivatePaneDirection, if the
current pane is zoomed, unzoom and then switch instead of doing nothing.

* Apply suggestions from code review

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
This commit is contained in:
JonathanandWez Furlong authored and GitHub committed 2021-11-13 11:43:15 -08:00
1 parent 30ab6f2026
commit e9ed2b4d3e
5 files changed
+24 -1

No files matched your search

+3
View File
@@ -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,
@@ -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)
@@ -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';
@@ -13,3 +13,5 @@ return {
}
}
```
See also: [`unzoom_on_switch_pane`](../config/unzoom_on_switch_pane.md)
+5 -1
View File
@@ -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();