aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorRobin2022-07-22 01:23:00 +0000
committerGitHub2022-07-22 01:23:00 +0000
commit19b7864062462e56545cfcca8402659573524f60 (patch)
tree27f799efac383ad2e20d845b2dce1825aa34c0b2 /helix-view/src/editor.rs
parent2f53644c6d7d70b680a5d734c8732e5f367aacf3 (diff)
keep jump/file history when using :split (#3031)
* keep jump/file history when using :split * move history cloning into the switch function Co-authored-by: Robin <robinvandijk@klippa.com>
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 {