Ticket #83: mc.patch

File mc.patch, 7.2 KB (added by nickk9, 12 years ago)
  • src/cmd.c

    diff -r -u -w mc-4.7.1-org/src/cmd.c mc-4.7.1-viewertoeditor/src/cmd.c
    old new  
    117117{ 
    118118    static const char *viewer = NULL; 
    119119    int move_dir = 0; 
     120    int run_editor = 0; 
    120121 
    121122 
    122123    if (plain_view) { 
     
    136137        mcview_default_hex_mode = 0; 
    137138        mcview_default_nroff_flag = 0; 
    138139        mcview_default_magic_flag = 0; 
    139         mcview_viewer (NULL, filename, &move_dir, start_line); 
     140        mcview_viewer (NULL, filename, &move_dir, start_line, &run_editor); 
    140141        if (changed_hex_mode && !mcview_altered_hex_mode) 
    141142            mcview_default_hex_mode = 1; 
    142143        if (changed_nroff_flag && !mcview_altered_nroff_flag) 
     
    144145        if (changed_magic_flag && !mcview_altered_magic_flag) 
    145146            mcview_default_magic_flag = 1; 
    146147        repaint_screen (); 
     148        if (run_editor) { 
     149                do_edit_at_line (filename, start_line); 
     150                repaint_screen (); 
     151        } 
    147152        return move_dir; 
    148153    } 
    149154    if (internal) { 
     
    156161            strcpy (view_entry, "View"); 
    157162 
    158163        if (regex_command (filename, view_entry, &move_dir) == 0) { 
    159             mcview_viewer (NULL, filename, &move_dir, start_line); 
     164            mcview_viewer (NULL, filename, &move_dir, start_line, &run_editor); 
    160165            repaint_screen (); 
    161166        } 
    162167    } else { 
     
    169174        } 
    170175        execute_with_vfs_arg (viewer, filename); 
    171176    } 
     177    if (run_editor) { 
     178        do_edit_at_line (filename, start_line); 
     179        repaint_screen (); 
     180    } 
    172181    return move_dir; 
    173182} 
    174183 
     
    289298    if (!command) 
    290299        return; 
    291300 
    292     mcview_viewer (command, "", NULL, 0); 
     301    mcview_viewer (command, "", NULL, 0, NULL); 
    293302 
    294303    g_free (command); 
    295304} 
  • src/cmddef.h

    diff -r -u -w mc-4.7.1-org/src/cmddef.h mc-4.7.1-viewertoeditor/src/cmddef.h
    old new  
    274274#define CK_ViewPrevFile                 5025 
    275275#define CK_ViewToggleRuler              5026 
    276276#define CK_ViewToggleHexNavMode         5027 
     277#define CK_ViewRunEditor                5028 
    277278 
    278279/* Tree */ 
    279280#define CK_TreeHelp                     6001 
  • src/ext.c

     
    diff -r -u -w mc-4.7.1-org/src/ext.c mc-4.7.1-viewertoeditor/src/ext.c
    old new  
    252252         * into view 
    253253         */ 
    254254        if (written_nonspace) { 
    255             mcview_viewer (cmd, filename, move_dir, start_line); 
     255            mcview_viewer (cmd, filename, move_dir, start_line, NULL); 
    256256            unlink (file_name); 
    257257        } else { 
    258             mcview_viewer (NULL, filename, move_dir, start_line); 
     258            mcview_viewer (NULL, filename, move_dir, start_line, NULL); 
    259259        } 
    260260        if (changed_hex_mode && !mcview_altered_hex_mode) 
    261261            mcview_default_hex_mode = def_hex_mode; 
  • src/keybind.c

    diff -r -u -w mc-4.7.1-org/src/keybind.c mc-4.7.1-viewertoeditor/src/keybind.c
    old new  
    249249    { "ViewPrevFile",                    CK_ViewPrevFile }, 
    250250    { "ViewToggleRuler",                 CK_ViewToggleRuler }, 
    251251    { "ViewToggleHexNavMode",            CK_ViewToggleHexNavMode }, 
     252    { "ViewRunEditor",                   CK_ViewRunEditor }, 
    252253 
    253254    /* help */ 
    254255    { "HelpHelp",                        CK_HelpHelp }, 
     
    514515    { ALT ('e'),   CK_SelectCodepage,        "M-e" }, 
    515516    { XCTRL ('o'), CK_ShowCommandLine,       "C-o" }, 
    516517 
     518    { KEY_F (14),  CK_ViewRunEditor,        "S-F4" }, 
     519 
    517520    { 0, CK_Ignore_Key, "" } 
    518521}; 
    519522 
  • src/main.c

    diff -r -u -w mc-4.7.1-org/src/main.c mc-4.7.1-viewertoeditor/src/main.c
    old new  
    16041604        } 
    16051605 
    16061606        /* Ctrl-Shift-Enter */ 
    1607         if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n')) { 
     1607        if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n'))  
     1608        { 
    16081609            copy_current_pathname (); 
    16091610            copy_prog_name (); 
    16101611            return MSG_HANDLED; 
  • src/user.c

    diff -r -u -w mc-4.7.1-org/src/user.c mc-4.7.1-viewertoeditor/src/user.c
    old new  
    702702    chmod (file_name, S_IRWXU); 
    703703    if (run_view) { 
    704704        run_view = 0; 
    705         mcview_viewer (file_name, NULL, &run_view, 0); 
     705        mcview_viewer (file_name, NULL, &run_view, 0, NULL); 
    706706    } else { 
    707707        /* execute the command indirectly to allow execution even 
    708708         * on no-exec filesystems. */ 
  • src/viewer/actions_cmd.c

    diff -r -u -w mc-4.7.1-org/src/viewer/actions_cmd.c mc-4.7.1-viewertoeditor/src/viewer/actions_cmd.c
    old new  
    439439        if (!mcview_is_in_panel (view)) 
    440440            view->move_dir = (command == CK_ViewNextFile) ? 1 : -1; 
    441441        /* fallthrough */ 
     442    case CK_ViewRunEditor: 
     443        view->run_editor = 1; 
    442444    case CK_ViewQuit: 
    443445        if (mcview_ok_to_quit (view)) 
    444446            view->want_to_quit = TRUE; 
  • src/viewer/internal.h

    diff -r -u -w mc-4.7.1-org/src/viewer/internal.h mc-4.7.1-viewertoeditor/src/viewer/internal.h
    old new  
    191191    struct mcview_nroff_struct *search_nroff_seq; 
    192192 
    193193    int search_numNeedSkipChar; 
     194 
     195    int run_editor; 
    194196} mcview_t; 
    195197 
    196198typedef struct mcview_nroff_struct 
  • src/viewer/mcviewer.c

    diff -r -u -w mc-4.7.1-org/src/viewer/mcviewer.c mc-4.7.1-viewertoeditor/src/viewer/mcviewer.c
    old new  
    257257    view->update_steps = 0; 
    258258    view->update_activate = 0; 
    259259 
     260    view->run_editor = 0; 
     261 
    260262    if (mcview_default_hex_mode) 
    261263        mcview_toggle_hex_mode (view); 
    262264    if (mcview_default_nroff_flag) 
     
    275277 
    276278/* Real view only */ 
    277279int 
    278 mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line) 
     280mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line, int * run_editor) 
    279281{ 
    280282    gboolean succeeded; 
    281283    mcview_t *lc_mcview; 
     
    296298        run_dlg (view_dlg); 
    297299        if (move_dir_p) 
    298300            *move_dir_p = lc_mcview->move_dir; 
     301        if (run_editor) 
     302            *run_editor = lc_mcview->run_editor; 
    299303    } 
    300304    else 
    301305    { 
  • src/viewer/mcviewer.h

    diff -r -u -w mc-4.7.1-org/src/viewer/mcviewer.h mc-4.7.1-viewertoeditor/src/viewer/mcviewer.h
    old new  
    4343 * point to a variable that will receive the direction in which the user 
    4444 * wants to move (-1 = previous file, 1 = next file, 0 = do nothing). 
    4545 */ 
    46 extern int mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line); 
     46extern int mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line, int * run_editor); 
    4747 
    4848extern gboolean mcview_load (struct mcview_struct *, const char *, const char *, int); 
    4949