Skip to content

Commit

Permalink
feat: make sure we don't try to launch an invalid editor (workaround …
Browse files Browse the repository at this point in the history
…for now)
  • Loading branch information
AndreCostaaa committed Sep 6, 2024
1 parent 57d5965 commit ebdb3f2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/editor/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ use std::env;

pub fn get_default_editor() -> Option<String> {
match env::var("EDITOR") {
Ok(editor) => Some(editor.into()),
Ok(editor) => {
let valid_editors: Vec<String> = vec![
String::from("code"),
String::from("codium"),
String::from("idea"),
];
if valid_editors.contains(&editor) {
Some(editor)
} else {
None
}
}
Err(_) => None,
}
}

0 comments on commit ebdb3f2

Please # to comment.