aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorRoland Kovacs2022-05-09 19:12:01 +0000
committerMichael Davis2022-05-21 13:53:16 +0000
commit3f10473d30eec79e135ea74fa2bc4cc996426128 (patch)
tree7b21d83f6a2f3c977e1c740e149d6ec9d930a8ab /helix-view/src/editor.rs
parente8e252648f0287ccd503c59ea2c1fd7a155dafb5 (diff)
Implement view swapping
* add Tree::swap_split_in_direction() * add swap_view_{left,down,up,right} commands, bound to H,J,K,L respectively in the Window menu(s) * add test for view swapping
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 1ad21059..3ba6fea8 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -885,6 +885,22 @@ impl Editor {
self.tree.focus_direction(tree::Direction::Down);
}
+ pub fn swap_right(&mut self) {
+ self.tree.swap_split_in_direction(tree::Direction::Right);
+ }
+
+ pub fn swap_left(&mut self) {
+ self.tree.swap_split_in_direction(tree::Direction::Left);
+ }
+
+ pub fn swap_up(&mut self) {
+ self.tree.swap_split_in_direction(tree::Direction::Up);
+ }
+
+ pub fn swap_down(&mut self) {
+ self.tree.swap_split_in_direction(tree::Direction::Down);
+ }
+
pub fn transpose_view(&mut self) {
self.tree.transpose();
}