on master help sign in
Add command to rotate view backward (#5356)
e7e47fdmejo13
helix-term/src/commands.rs+5
@@ -384,6 +384,7 @@ impl MappableCommand {
384 swap_view_down, "Swap with split below",
384 swap_view_down, "Swap with split below",
385 transpose_view, "Transpose splits",
385 transpose_view, "Transpose splits",
386 rotate_view, "Goto next window",
386 rotate_view, "Goto next window",
387+ rotate_view_reverse, "Goto previous window",
387 hsplit, "Horizontal bottom split",
388 hsplit, "Horizontal bottom split",
388 hsplit_new, "Horizontal bottom split scratch buffer",
389 hsplit_new, "Horizontal bottom split scratch buffer",
389 vsplit, "Vertical right split",
390 vsplit, "Vertical right split",
@@ -4317,6 +4318,10 @@ fn rotate_view(cx: &mut Context) {
4317 cx.editor.focus_next()
4318 cx.editor.focus_next()
4318}
4319}
4319
4320
4321+fn rotate_view_reverse(cx: &mut Context) {
4322+ cx.editor.focus_prev()
4323+}
4324+
4320fn jump_view_right(cx: &mut Context) {
4325fn jump_view_right(cx: &mut Context) {
4321 cx.editor.focus_direction(tree::Direction::Right)
4326 cx.editor.focus_direction(tree::Direction::Right)
4322}
4327}
helix-view/src/editor.rs+4
@@ -1285,6 +1285,10 @@ impl Editor {
1285 self.focus(self.tree.next());
1285 self.focus(self.tree.next());
1286 }
1286 }
1287
1287
1288+ pub fn focus_prev(&mut self) {
1289+ self.focus(self.tree.prev());
1290+ }
1291+
1288 pub fn focus_direction(&mut self, direction: tree::Direction) {
1292 pub fn focus_direction(&mut self, direction: tree::Direction) {
1289 let current_view = self.tree.focus;
1293 let current_view = self.tree.focus;
1290 if let Some(id) = self.tree.find_split_in_direction(current_view, direction) {
1294 if let Some(id) = self.tree.find_split_in_direction(current_view, direction) {