Open file browser in cwd when no buffer path

This commit is contained in:
Denys Rybalka 2024-09-13 13:44:30 +02:00
parent 268eac8c00
commit ff833b79e7
No known key found for this signature in database
GPG key ID: 1F6284E97DB46ED1

View file

@ -2995,8 +2995,14 @@ fn file_browser(cx: &mut Context) {
let path = match doc_dir {
Some(path) => path,
None => {
cx.editor.set_error("Current buffer has no path or parent");
return;
let cwd = helix_stdx::env::current_working_dir();
if !cwd.exists() {
cx.editor.set_error(
"Current buffer has no parent and current working directory does not exist",
);
return;
}
cwd
}
};