ACTION_ASYNC = 1 << 5,
ACTION_OPEN_IN = 1 << 6,
ACTION_HIDE_IN = 1 << 7,
- ACTION_ERROR = 1 << 8,
+ ACTION_INSERT = 1 << 8,
+ ACTION_ERROR = 1 << 9,
} ActionType;
static struct Actions
" * to send user provided hidden text to command\n"
" End with:\n"
" | to replace message body or selection with command output\n"
+ " > to insert command's output without replacing old text\n"
" & to run command asynchronously\n"
" Use %f for message file name\n"
" %F for the list of the file names of selected messages\n"
} else if (p[0] == '|') {
if (p[1] == 0x00)
action_type |= ACTION_PIPE_OUT;
+ } else if (p[0] == '>') {
+ if (p[1] == 0x00)
+ action_type |= ACTION_INSERT;
} else if (p[0] == '&') {
if (p[1] == 0x00)
action_type |= ACTION_ASYNC;
cmd = g_string_sized_new(strlen(action));
- while (p[0] && !(p[0] == '|' && !p[1]) && p[0] != '&') {
+ while (p[0] &&
+ !((p[0] == '|' || p[0] == '>' || p[0] == '&') && !p[1])) {
if (p[0] == '%' && p[1]) {
switch (p[1]) {
case 'f':
selection_len = g_list_length(selection);
}
- if (action_type & (ACTION_PIPE_OUT | ACTION_PIPE_IN)) {
+ if (action_type & (ACTION_PIPE_OUT | ACTION_PIPE_IN | ACTION_INSERT)) {
if (ctree && selection_len > 1)
return FALSE; /* ERR: pipe + multiple selection */
if (!text)
child_info->tag_err = gdk_input_add(chld_err[0], GDK_INPUT_READ,
catch_output, child_info);
- if (!(action_type & (ACTION_PIPE_IN | ACTION_PIPE_OUT)))
+ if (!(action_type & (ACTION_PIPE_IN | ACTION_PIPE_OUT | ACTION_INSERT)))
return child_info;
child_info->text = text;
gchar buf[PREFSBUFSIZE];
debug_print("Catching grand child's output.\n");
- if (child_info->type & ACTION_PIPE_OUT
+ if (child_info->type & (ACTION_PIPE_OUT | ACTION_INSERT)
&& source == child_info->chld_out) {
gboolean is_selection = FALSE;
GtkWidget *text = child_info->text;