fix(editor): default to vi when no editor is set (#1811)
* fix(editor): default to vi when no editor is set * style(fmt): rustfmt
This commit is contained in:
parent
5c8cded2f5
commit
617b52f8f4
2 changed files with 5 additions and 8 deletions
|
|
@ -245,15 +245,11 @@ fn spawn_terminal(
|
||||||
let mut failover_cmd_args = None;
|
let mut failover_cmd_args = None;
|
||||||
let cmd = match terminal_action {
|
let cmd = match terminal_action {
|
||||||
TerminalAction::OpenFile(file_to_open, line_number) => {
|
TerminalAction::OpenFile(file_to_open, line_number) => {
|
||||||
if default_editor.is_none()
|
|
||||||
&& env::var("EDITOR").is_err()
|
|
||||||
&& env::var("VISUAL").is_err()
|
|
||||||
{
|
|
||||||
return Err(SpawnTerminalError::NoEditorFound);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut command = default_editor.unwrap_or_else(|| {
|
let mut command = default_editor.unwrap_or_else(|| {
|
||||||
PathBuf::from(env::var("EDITOR").unwrap_or_else(|_| env::var("VISUAL").unwrap()))
|
PathBuf::from(
|
||||||
|
env::var("EDITOR")
|
||||||
|
.unwrap_or_else(|_| env::var("VISUAL").unwrap_or_else(|_| "vi".into())),
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut args = vec![];
|
let mut args = vec![];
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box<Layout>) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
log::error!("Failed to spawn terminal: command not found");
|
||||||
pty.close_pane(PaneId::Terminal(pid));
|
pty.close_pane(PaneId::Terminal(pid));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue