mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Editor executable support flags
* Make editor executable into a string to be able to support (multiple) flags. * Change /help executable to suit this new feature Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
This commit is contained in:
parent
2093fe417f
commit
007f623ad8
@ -2545,7 +2545,7 @@ static const struct cmd_t command_defs[] = {
|
||||
"/executable urlsave set \"curl %u -o %p\"",
|
||||
"/executable urlsave default",
|
||||
"/executable vcard_photo set \"feh %p\"",
|
||||
"/executable editor set vim")
|
||||
"/executable editor set \"emacsclient -t\"")
|
||||
},
|
||||
|
||||
{ CMD_PREAMBLE("/url",
|
||||
|
@ -88,11 +88,16 @@ get_message_from_editor(gchar* message, gchar** returned_message)
|
||||
}
|
||||
|
||||
char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
|
||||
gchar* editor_with_filename = g_strdup_printf("%s %s", editor, filename);
|
||||
gchar** editor_argv = g_strsplit(editor_with_filename, " ", 0);
|
||||
|
||||
g_free(editor_with_filename);
|
||||
|
||||
// Fork / exec
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
int x = execlp(editor, editor, filename, (char*)NULL);
|
||||
int x = execvp(editor_argv[0], editor_argv);
|
||||
g_strfreev(editor_argv);
|
||||
if (x == -1) {
|
||||
log_error("[Editor] Failed to exec %s", editor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user