summaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-07 05:36:06 +0000
committerBlaž Hrastnik2021-05-07 05:36:37 +0000
commitf2c79e245bdcc70be3c51fdca35917a929615152 (patch)
treefc14a7da3ffab6e1cbd9b35029289afe623552bd /helix-view/src/editor.rs
parent418ee17b86c24f03699659f4aa91b331a68e5666 (diff)
Allow switching views back to scratch buffers.
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 84d499e3..256e0e83 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -66,7 +66,7 @@ impl Editor {
}
}
- fn _open(&mut self, id: DocumentId, action: Action) -> Result<DocumentId, Error> {
+ pub fn switch(&mut self, id: DocumentId, action: Action) -> Result<DocumentId, Error> {
use crate::tree::Layout;
use helix_core::Selection;
match action {
@@ -115,7 +115,7 @@ impl Editor {
let doc = Document::new(Rope::from("\n"));
let id = self.documents.insert(doc);
self.documents[id].id = id;
- self._open(id, action)
+ self.switch(id, action)
}
pub fn open(&mut self, path: PathBuf, action: Action) -> Result<DocumentId, Error> {
@@ -159,7 +159,7 @@ impl Editor {
id
};
- self._open(id, action)
+ self.switch(id, action)
}
pub fn close(&mut self, id: ViewId) {