Add command to rotate view backward (#5356)

pull/5568/head
mejo13 2 years ago committed by GitHub
parent 9530fab4b6
commit e7e47fd542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -384,6 +384,7 @@ impl MappableCommand {
swap_view_down, "Swap with split below", swap_view_down, "Swap with split below",
transpose_view, "Transpose splits", transpose_view, "Transpose splits",
rotate_view, "Goto next window", rotate_view, "Goto next window",
rotate_view_reverse, "Goto previous window",
hsplit, "Horizontal bottom split", hsplit, "Horizontal bottom split",
hsplit_new, "Horizontal bottom split scratch buffer", hsplit_new, "Horizontal bottom split scratch buffer",
vsplit, "Vertical right split", vsplit, "Vertical right split",
@ -4317,6 +4318,10 @@ fn rotate_view(cx: &mut Context) {
cx.editor.focus_next() cx.editor.focus_next()
} }
fn rotate_view_reverse(cx: &mut Context) {
cx.editor.focus_prev()
}
fn jump_view_right(cx: &mut Context) { fn jump_view_right(cx: &mut Context) {
cx.editor.focus_direction(tree::Direction::Right) cx.editor.focus_direction(tree::Direction::Right)
} }

@ -1285,6 +1285,10 @@ impl Editor {
self.focus(self.tree.next()); self.focus(self.tree.next());
} }
pub fn focus_prev(&mut self) {
self.focus(self.tree.prev());
}
pub fn focus_direction(&mut self, direction: tree::Direction) { pub fn focus_direction(&mut self, direction: tree::Direction) {
let current_view = self.tree.focus; let current_view = self.tree.focus;
if let Some(id) = self.tree.find_split_in_direction(current_view, direction) { if let Some(id) = self.tree.find_split_in_direction(current_view, direction) {

Loading…
Cancel
Save