aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands
diff options
context:
space:
mode:
authoralois312022-12-24 13:50:39 +0000
committerGitHub2022-12-24 13:50:39 +0000
commiteb4ec3271005e9de7960a4dd08a9efbb648cb89f (patch)
treebe2cf8b0ac0f1c5aa1b5afdbfa68278ebb1460e8 /helix-term/src/commands
parentf0c6e6c9eeb1f2772571bcefe02bd344fa70d62f (diff)
Fix opening new files (#5278)
Commit 1b89d3e5350f83b2ffb86a86326bd2714308ee53 introduced a regression where opening a new file would no longer work, because attempting to canonicalize its path would lead to a "No such file or directory" error. Fall back to opening a new file when encountering an error to fix this case.
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r--helix-term/src/commands/typed.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index c3a7c9fa..c2ca1a47 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -67,7 +67,7 @@ fn open(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
let (path, pos) = args::parse_file(arg);
// If the path is a directory, open a file picker on that directory and update the status
// message
- if std::fs::canonicalize(&path)?.is_dir() {
+ if let Ok(true) = std::fs::canonicalize(&path).map(|p| p.is_dir()) {
let callback = async move {
let call: job::Callback = job::Callback::EditorCompositor(Box::new(
move |editor: &mut Editor, compositor: &mut Compositor| {