From a5a0dd6c919a2b4f12ef2b4f57a0d9a2a9cabf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 30 May 2021 22:35:17 +0200 Subject: [PATCH] external editor: don't use absolute paths and allow path search --- src/command/cmd_funcs.c | 6 +----- src/config/preferences.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index b2262c5f..a56f0cfc 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -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); } diff --git a/src/config/preferences.c b/src/config/preferences.c index 4ff51092..c930fccd 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -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: