1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge pull request #1546 from Mic92/editor

external editor: don't use absolute paths and allow path search
This commit is contained in:
Michael Vetter 2021-05-31 09:10:15 +02:00 committed by GitHub
commit 9f174c53cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -9418,15 +9418,11 @@ cmd_editor(ProfWin* window, const char* const command, gchar** args)
g_object_unref(fos);
char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
if (!g_file_test(editor, G_FILE_TEST_EXISTS)) {
cons_show_error("Editor: binary %s not exist", editor);
return TRUE;
}
// Fork / exec
pid_t pid = fork();
if (pid == 0) {
int x = execl(editor, editor, g_file_get_path(file), (char*)NULL);
int x = execlp(editor, editor, g_file_get_path(file), (char*)NULL);
if (x == -1) {
cons_show_error("Editor:Failed to exec %s", editor);
}

View File

@ -2340,7 +2340,7 @@ _get_default_string(preference_t pref)
case PREF_URL_OPEN_CMD:
return "xdg-open %u";
case PREF_COMPOSE_EDITOR:
return "/usr/bin/vim";
return "vim";
case PREF_URL_SAVE_CMD:
return NULL; // Default to built-in method.
default: