@@ -66,7 +66,7 @@ impl Editor {
6666 }
6767 }
6868
69− pub fn switch(&mut self, id: DocumentId, action: Action) -> Result<DocumentId, Error> {
69+ pub fn switch(&mut self, id: DocumentId, action: Action) {
7070 use crate::tree::Layout;
7171 use helix_core::Selection;
7272 match action {
@@ -87,17 +87,17 @@ impl Editor {
8787 let doc = &mut self.documents[id];
8888 doc.selections.insert(view_id, Selection::point(0));
8989
90− return Ok(id);
90+ return;
9191 }
9292 Action::HorizontalSplit => {
93− let view = View::new(id)?;
93+ let view = View::new(id);
9494 let view_id = self.tree.split(view, Layout::Horizontal);
9595 // initialize selection for view
9696 let doc = &mut self.documents[id];
9797 doc.selections.insert(view_id, Selection::point(0));
9898 }
9999 Action::VerticalSplit => {
100− let view = View::new(id)?;
100+ let view = View::new(id);
101101 let view_id = self.tree.split(view, Layout::Vertical);
102102 // initialize selection for view
103103 let doc = &mut self.documents[id];
@@ -106,16 +106,15 @@ impl Editor {
106106 }
107107
108108 self._refresh();
109−
110− Ok(id)
111109 }
112110
113− pub fn new_file(&mut self, action: Action) -> Result<DocumentId, Error> {
111+ pub fn new_file(&mut self, action: Action) -> DocumentId {
114112 use helix_core::Rope;
115113 let doc = Document::new(Rope::from("\n"));
116114 let id = self.documents.insert(doc);
117115 self.documents[id].id = id;
118− self.switch(id, action)
116+ self.switch(id, action);
117+ id
119118 }
120119
121120 pub fn open(&mut self, path: PathBuf, action: Action) -> Result<DocumentId, Error> {
@@ -159,7 +158,8 @@ impl Editor {
159158 id
160159 };
161160
162− self.switch(id, action)
161+ self.switch(id, action);
162+ Ok(id)
163163 }
164164
165165 pub fn close(&mut self, id: ViewId) {