aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 7ac52f50..6cd4515c 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -874,7 +874,12 @@ impl Editor {
return;
}
Action::HorizontalSplit | Action::VerticalSplit => {
- let view = View::new(id, self.config().gutters.clone());
+ // copy the current view, unless there is no view yet
+ let view = self
+ .tree
+ .try_get(self.tree.focus)
+ .cloned()
+ .unwrap_or_else(|| View::new(id, self.config().gutters.clone()));
let view_id = self.tree.split(
view,
match action {