Ticket #4514: open_marked_in_editor.diff

File open_marked_in_editor.diff, 1.5 KB (added by jonn, 12 months ago)
  • src/filemanager/cmd.c

    diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
    index 76f21acdb..4f2fa6493 100644
    a b  
    6969#include "src/history.h" 
    7070#include "src/usermenu.h"       /* MC_GLOBAL_MENU */ 
    7171#include "src/util.h"           /* check_for_default() */ 
     72#include "src/args.h"           /* mcedit_arg_t */ 
    7273 
    7374#include "src/viewer/mcviewer.h" 
    7475 
    void 
    699700edit_cmd (const WPanel * panel) 
    700701{ 
    701702    vfs_path_t *fname; 
    702  
    703     fname = vfs_path_from_str (panel_current_entry (panel)->fname->str); 
    704     if (regex_command (fname, "Edit") == 0) 
    705         do_edit (fname); 
    706     vfs_path_free (fname, TRUE); 
     703    if (panel->marked != 0) 
     704    { 
     705        int i; 
     706        GList *files = NULL; 
     707        mcedit_arg_t *arg; 
     708        for (i = 0; i < panel->dir.len; i++) 
     709        { 
     710            if (panel->dir.list[i].f.marked != 0) 
     711            { 
     712                arg = g_new (mcedit_arg_t, 1); 
     713                arg->file_vpath = vfs_path_from_str (panel->dir.list[i].fname->str); 
     714                arg->line_number = 0; 
     715                files = g_list_prepend (files, arg); 
     716            } 
     717        } 
     718        edit_files (files); 
     719        g_list_free_full (files, mcedit_arg_free); 
     720    } 
     721    else 
     722    { 
     723        fname = vfs_path_from_str (panel_current_entry (panel)->fname->str); 
     724        if (regex_command (fname, "Edit") == 0) 
     725            do_edit (fname); 
     726        vfs_path_free (fname, TRUE); 
     727    } 
    707728} 
    708729 
    709730/* --------------------------------------------------------------------------------------------- */