aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs13
-rw-r--r--helix-term/src/commands/typed.rs2
-rw-r--r--helix-term/src/ui/picker.rs10
3 files changed, 8 insertions, 17 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index a97ae503..3e938917 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -160,7 +160,7 @@ impl Application {
let path = helix_loader::runtime_file(Path::new("tutor"));
editor.open(&path, Action::VerticalSplit)?;
// Unset path to prevent accidentally saving to the original tutor file.
- doc_mut!(editor).set_path(None)?;
+ doc_mut!(editor).set_path(None);
} else if !args.files.is_empty() {
let first = &args.files[0].0; // we know it's not empty
if first.is_dir() {
@@ -554,16 +554,7 @@ impl Application {
let bytes = doc_save_event.text.len_bytes();
if doc.path() != Some(&doc_save_event.path) {
- if let Err(err) = doc.set_path(Some(&doc_save_event.path)) {
- log::error!(
- "error setting path for doc '{:?}': {}",
- doc.path(),
- err.to_string(),
- );
-
- self.editor.set_error(err.to_string());
- return;
- }
+ doc.set_path(Some(&doc_save_event.path));
let loader = self.editor.syn_loader.clone();
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 4c7314b6..a7eb2244 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1679,7 +1679,7 @@ fn tutor(
let path = helix_loader::runtime_file(Path::new("tutor"));
cx.editor.open(&path, Action::Replace)?;
// Unset path to prevent accidentally saving to the original tutor file.
- doc_mut!(cx.editor).set_path(None)?;
+ doc_mut!(cx.editor).set_path(None);
Ok(())
}
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 5ee4c407..b134eb47 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -51,12 +51,12 @@ pub enum PathOrId {
}
impl PathOrId {
- fn get_canonicalized(self) -> std::io::Result<Self> {
+ fn get_canonicalized(self) -> Self {
use PathOrId::*;
- Ok(match self {
- Path(path) => Path(helix_core::path::get_canonicalized_path(&path)?),
+ match self {
+ Path(path) => Path(helix_core::path::get_canonicalized_path(&path)),
Id(id) => Id(id),
- })
+ }
}
}
@@ -375,7 +375,7 @@ impl<T: Item + 'static> Picker<T> {
fn current_file(&self, editor: &Editor) -> Option<FileLocation> {
self.selection()
.and_then(|current| (self.file_fn.as_ref()?)(editor, current))
- .and_then(|(path_or_id, line)| path_or_id.get_canonicalized().ok().zip(Some(line)))
+ .map(|(path_or_id, line)| (path_or_id.get_canonicalized(), line))
}
/// Get (cached) preview for a given path. If a document corresponding