mirror of
https://github.com/wez/wezterm.git
synced 2024-09-20 03:09:06 +03:00
ActivatePaneDirection now supports Next and Prev
This allows cycling through all the panes in a tab refs: #976
This commit is contained in:
parent
c96c36fb6e
commit
225d15c9aa
@ -110,6 +110,8 @@ pub enum PaneDirection {
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
Next,
|
||||
Prev,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
|
@ -23,6 +23,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* [QuickSelectArgs](config/lua/keyassignment/QuickSelectArgs.md) key assignment [#846](https://github.com/wez/wezterm/issues/846) [#1362](https://github.com/wez/wezterm/issues/1362)
|
||||
* [wezterm.open_wth](config/lua/wezterm/open_with.md) function for opening URLs/documents with the default or a specific application [#1362](https://github.com/wez/wezterm/issues/1362)
|
||||
* [pane:get_foreground_process_name()](config/lua/pane/get_foreground_process_name.md) method, [PaneInformation](config/lua/PaneInformation.md) now has `foreground_process_name` and `current_working_dir` fields. [#1421](https://github.com/wez/wezterm/discussions/1421) [#915](https://github.com/wez/wezterm/issues/915) [#876](https://github.com/wez/wezterm/issues/876)
|
||||
* [ActivatePaneDirection](config/lua/keyassignment/ActivatePaneDirection.md) now also supports `"Next"` and `"Prev"` to cycle through panes [#976](https://github.com/wez/wezterm/issues/976)
|
||||
|
||||
#### Changed
|
||||
|
||||
|
@ -25,3 +25,14 @@ return {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*Since: nightly builds only*
|
||||
|
||||
You may now use `"Next"` and `"Prev"` as directions. These cycle
|
||||
through the panes according to their position in the pane tree.
|
||||
|
||||
`"Next"` moves to the next highest pane index, wrapping around to 0
|
||||
if the active pane is already the highest pane index.
|
||||
|
||||
`"Prev"` moves to the next lowest pane index, wrapping around to
|
||||
the highest of the active pane is already the lowest pane index.
|
||||
|
@ -1006,10 +1006,12 @@ impl Tab {
|
||||
let split_direction = match direction {
|
||||
PaneDirection::Left | PaneDirection::Right => SplitDirection::Horizontal,
|
||||
PaneDirection::Up | PaneDirection::Down => SplitDirection::Vertical,
|
||||
PaneDirection::Next | PaneDirection::Prev => unreachable!(),
|
||||
};
|
||||
let delta = match direction {
|
||||
PaneDirection::Down | PaneDirection::Right => amount as isize,
|
||||
PaneDirection::Up | PaneDirection::Left => -(amount as isize),
|
||||
PaneDirection::Next | PaneDirection::Prev => unreachable!(),
|
||||
};
|
||||
loop {
|
||||
match cursor.go_up() {
|
||||
@ -1055,6 +1057,25 @@ impl Tab {
|
||||
}
|
||||
};
|
||||
|
||||
if matches!(direction, PaneDirection::Next | PaneDirection::Prev) {
|
||||
let max_pane_id = panes.iter().map(|p| p.index).max().unwrap_or(active.index);
|
||||
|
||||
if direction == PaneDirection::Next {
|
||||
self.set_active_idx(if active.index == max_pane_id {
|
||||
0
|
||||
} else {
|
||||
active.index + 1
|
||||
});
|
||||
} else {
|
||||
self.set_active_idx(if active.index == 0 {
|
||||
max_pane_id
|
||||
} else {
|
||||
active.index - 1
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let mut best = None;
|
||||
|
||||
/// Compute the edge intersection size between two touching panes
|
||||
@ -1102,6 +1123,7 @@ impl Tab {
|
||||
0
|
||||
}
|
||||
}
|
||||
PaneDirection::Next | PaneDirection::Prev => unreachable!(),
|
||||
};
|
||||
|
||||
if score > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user