Add ctrl-w _ and ctrl-w = (#21227)

Closes #ISSUE

Release Notes:

- vim: Add support for `ctrl-w _` and `ctrl-w =`
This commit is contained in:
Conrad Irwin 2024-11-26 16:45:38 -08:00 committed by GitHub
parent f702575255
commit 4e720be41c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 4 deletions

View file

@ -105,6 +105,15 @@ impl PaneGroup {
};
}
pub fn reset_pane_sizes(&mut self) {
match &mut self.root {
Member::Pane(_) => {}
Member::Axis(axis) => {
let _ = axis.reset_pane_sizes();
}
};
}
pub fn swap(&mut self, from: &View<Pane>, to: &View<Pane>) {
match &mut self.root {
Member::Pane(_) => {}
@ -460,6 +469,15 @@ impl PaneAxis {
}
}
fn reset_pane_sizes(&self) {
*self.flexes.lock() = vec![1.; self.members.len()];
for member in self.members.iter() {
if let Member::Axis(axis) = member {
axis.reset_pane_sizes();
}
}
}
fn resize(
&mut self,
pane: &View<Pane>,
@ -759,7 +777,6 @@ pub enum ResizeIntent {
}
mod element {
use std::mem;
use std::{cell::RefCell, iter, rc::Rc, sync::Arc};

View file

@ -2946,6 +2946,10 @@ impl Workspace {
}
}
pub fn bounding_box_for_pane(&self, pane: &View<Pane>) -> Option<Bounds<Pixels>> {
self.center.bounding_box_for_pane(pane)
}
pub fn find_pane_in_direction(
&mut self,
direction: SplitDirection,
@ -2994,6 +2998,11 @@ impl Workspace {
cx.notify();
}
pub fn reset_pane_sizes(&mut self, cx: &mut ViewContext<Self>) {
self.center.reset_pane_sizes();
cx.notify();
}
fn handle_pane_focused(&mut self, pane: View<Pane>, cx: &mut ViewContext<Self>) {
// This is explicitly hoisted out of the following check for pane identity as
// terminal panel panes are not registered as a center panes.