diff options
author | Robin | 2022-07-22 01:23:00 +0000 |
---|---|---|
committer | GitHub | 2022-07-22 01:23:00 +0000 |
commit | 19b7864062462e56545cfcca8402659573524f60 (patch) | |
tree | 27f799efac383ad2e20d845b2dce1825aa34c0b2 /helix-view/src/tree.rs | |
parent | 2f53644c6d7d70b680a5d734c8732e5f367aacf3 (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/tree.rs')
-rw-r--r-- | helix-view/src/tree.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs index 3ba85b56..c4474c33 100644 --- a/helix-view/src/tree.rs +++ b/helix-view/src/tree.rs @@ -271,12 +271,16 @@ impl Tree { } pub fn get(&self, index: ViewId) -> &View { + self.try_get(index).unwrap() + } + + pub fn try_get(&self, index: ViewId) -> Option<&View> { match &self.nodes[index] { Node { content: Content::View(view), .. - } => view, - _ => unreachable!(), + } => Some(view), + _ => None, } } |