fix: When EDITOR, VISUAL, or config.editor is defined, don't verify via which
CI / All (ubuntu-latest) (push) Failing after 25s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-15 15:16:41 -06:00
parent 19cca06db6
commit 7f89a80f7e
+10 -9
View File
@@ -311,16 +311,17 @@ impl AppConfig {
pub fn editor(&self) -> Result<String> { pub fn editor(&self) -> Result<String> {
super::EDITOR.get_or_init(move || { super::EDITOR.get_or_init(move || {
let editor = self.editor.clone() if let Some(editor) = self.editor.clone()
.or_else(|| env::var("VISUAL").ok().or_else(|| env::var("EDITOR").ok())) .or_else(|| env::var("VISUAL").ok().or_else(|| env::var("EDITOR").ok()))
.unwrap_or_else(|| { {
if cfg!(windows) { return Some(editor);
"notepad".to_string() }
} else { let default = if cfg!(windows) {
"nano".to_string() "notepad".to_string()
} } else {
}); "nano".to_string()
which::which(&editor).ok().map(|_| editor) };
which::which(&default).ok().map(|_| default)
}) })
.clone() .clone()
.ok_or_else(|| anyhow!("Editor not found. Please add the `editor` configuration or set the $EDITOR or $VISUAL environment variable.")) .ok_or_else(|| anyhow!("Editor not found. Please add the `editor` configuration or set the $EDITOR or $VISUAL environment variable."))