diff -r -u -w mc-4.7.1-org/src/cmd.c mc-4.7.1-viewertoeditor/src/cmd.c
old
|
new
|
|
117 | 117 | { |
118 | 118 | static const char *viewer = NULL; |
119 | 119 | int move_dir = 0; |
| 120 | int run_editor = 0; |
120 | 121 | |
121 | 122 | |
122 | 123 | if (plain_view) { |
… |
… |
|
136 | 137 | mcview_default_hex_mode = 0; |
137 | 138 | mcview_default_nroff_flag = 0; |
138 | 139 | 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); |
140 | 141 | if (changed_hex_mode && !mcview_altered_hex_mode) |
141 | 142 | mcview_default_hex_mode = 1; |
142 | 143 | if (changed_nroff_flag && !mcview_altered_nroff_flag) |
… |
… |
|
144 | 145 | if (changed_magic_flag && !mcview_altered_magic_flag) |
145 | 146 | mcview_default_magic_flag = 1; |
146 | 147 | repaint_screen (); |
| 148 | if (run_editor) { |
| 149 | do_edit_at_line (filename, start_line); |
| 150 | repaint_screen (); |
| 151 | } |
147 | 152 | return move_dir; |
148 | 153 | } |
149 | 154 | if (internal) { |
… |
… |
|
156 | 161 | strcpy (view_entry, "View"); |
157 | 162 | |
158 | 163 | 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); |
160 | 165 | repaint_screen (); |
161 | 166 | } |
162 | 167 | } else { |
… |
… |
|
169 | 174 | } |
170 | 175 | execute_with_vfs_arg (viewer, filename); |
171 | 176 | } |
| 177 | if (run_editor) { |
| 178 | do_edit_at_line (filename, start_line); |
| 179 | repaint_screen (); |
| 180 | } |
172 | 181 | return move_dir; |
173 | 182 | } |
174 | 183 | |
… |
… |
|
289 | 298 | if (!command) |
290 | 299 | return; |
291 | 300 | |
292 | | mcview_viewer (command, "", NULL, 0); |
| 301 | mcview_viewer (command, "", NULL, 0, NULL); |
293 | 302 | |
294 | 303 | g_free (command); |
295 | 304 | } |
diff -r -u -w mc-4.7.1-org/src/cmddef.h mc-4.7.1-viewertoeditor/src/cmddef.h
old
|
new
|
|
274 | 274 | #define CK_ViewPrevFile 5025 |
275 | 275 | #define CK_ViewToggleRuler 5026 |
276 | 276 | #define CK_ViewToggleHexNavMode 5027 |
| 277 | #define CK_ViewRunEditor 5028 |
277 | 278 | |
278 | 279 | /* Tree */ |
279 | 280 | #define CK_TreeHelp 6001 |
diff -r -u -w mc-4.7.1-org/src/ext.c mc-4.7.1-viewertoeditor/src/ext.c
old
|
new
|
|
252 | 252 | * into view |
253 | 253 | */ |
254 | 254 | if (written_nonspace) { |
255 | | mcview_viewer (cmd, filename, move_dir, start_line); |
| 255 | mcview_viewer (cmd, filename, move_dir, start_line, NULL); |
256 | 256 | unlink (file_name); |
257 | 257 | } else { |
258 | | mcview_viewer (NULL, filename, move_dir, start_line); |
| 258 | mcview_viewer (NULL, filename, move_dir, start_line, NULL); |
259 | 259 | } |
260 | 260 | if (changed_hex_mode && !mcview_altered_hex_mode) |
261 | 261 | mcview_default_hex_mode = def_hex_mode; |
diff -r -u -w mc-4.7.1-org/src/keybind.c mc-4.7.1-viewertoeditor/src/keybind.c
old
|
new
|
|
249 | 249 | { "ViewPrevFile", CK_ViewPrevFile }, |
250 | 250 | { "ViewToggleRuler", CK_ViewToggleRuler }, |
251 | 251 | { "ViewToggleHexNavMode", CK_ViewToggleHexNavMode }, |
| 252 | { "ViewRunEditor", CK_ViewRunEditor }, |
252 | 253 | |
253 | 254 | /* help */ |
254 | 255 | { "HelpHelp", CK_HelpHelp }, |
… |
… |
|
514 | 515 | { ALT ('e'), CK_SelectCodepage, "M-e" }, |
515 | 516 | { XCTRL ('o'), CK_ShowCommandLine, "C-o" }, |
516 | 517 | |
| 518 | { KEY_F (14), CK_ViewRunEditor, "S-F4" }, |
| 519 | |
517 | 520 | { 0, CK_Ignore_Key, "" } |
518 | 521 | }; |
519 | 522 | |
diff -r -u -w mc-4.7.1-org/src/main.c mc-4.7.1-viewertoeditor/src/main.c
old
|
new
|
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | /* Ctrl-Shift-Enter */ |
1607 | | if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n')) { |
| 1607 | if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n')) |
| 1608 | { |
1608 | 1609 | copy_current_pathname (); |
1609 | 1610 | copy_prog_name (); |
1610 | 1611 | return MSG_HANDLED; |
diff -r -u -w mc-4.7.1-org/src/user.c mc-4.7.1-viewertoeditor/src/user.c
old
|
new
|
|
702 | 702 | chmod (file_name, S_IRWXU); |
703 | 703 | if (run_view) { |
704 | 704 | run_view = 0; |
705 | | mcview_viewer (file_name, NULL, &run_view, 0); |
| 705 | mcview_viewer (file_name, NULL, &run_view, 0, NULL); |
706 | 706 | } else { |
707 | 707 | /* execute the command indirectly to allow execution even |
708 | 708 | * on no-exec filesystems. */ |
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
|
|
439 | 439 | if (!mcview_is_in_panel (view)) |
440 | 440 | view->move_dir = (command == CK_ViewNextFile) ? 1 : -1; |
441 | 441 | /* fallthrough */ |
| 442 | case CK_ViewRunEditor: |
| 443 | view->run_editor = 1; |
442 | 444 | case CK_ViewQuit: |
443 | 445 | if (mcview_ok_to_quit (view)) |
444 | 446 | view->want_to_quit = TRUE; |
diff -r -u -w mc-4.7.1-org/src/viewer/internal.h mc-4.7.1-viewertoeditor/src/viewer/internal.h
old
|
new
|
|
191 | 191 | struct mcview_nroff_struct *search_nroff_seq; |
192 | 192 | |
193 | 193 | int search_numNeedSkipChar; |
| 194 | |
| 195 | int run_editor; |
194 | 196 | } mcview_t; |
195 | 197 | |
196 | 198 | typedef struct mcview_nroff_struct |
diff -r -u -w mc-4.7.1-org/src/viewer/mcviewer.c mc-4.7.1-viewertoeditor/src/viewer/mcviewer.c
old
|
new
|
|
257 | 257 | view->update_steps = 0; |
258 | 258 | view->update_activate = 0; |
259 | 259 | |
| 260 | view->run_editor = 0; |
| 261 | |
260 | 262 | if (mcview_default_hex_mode) |
261 | 263 | mcview_toggle_hex_mode (view); |
262 | 264 | if (mcview_default_nroff_flag) |
… |
… |
|
275 | 277 | |
276 | 278 | /* Real view only */ |
277 | 279 | int |
278 | | mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line) |
| 280 | mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line, int * run_editor) |
279 | 281 | { |
280 | 282 | gboolean succeeded; |
281 | 283 | mcview_t *lc_mcview; |
… |
… |
|
296 | 298 | run_dlg (view_dlg); |
297 | 299 | if (move_dir_p) |
298 | 300 | *move_dir_p = lc_mcview->move_dir; |
| 301 | if (run_editor) |
| 302 | *run_editor = lc_mcview->run_editor; |
299 | 303 | } |
300 | 304 | else |
301 | 305 | { |
diff -r -u -w mc-4.7.1-org/src/viewer/mcviewer.h mc-4.7.1-viewertoeditor/src/viewer/mcviewer.h
old
|
new
|
|
43 | 43 | * point to a variable that will receive the direction in which the user |
44 | 44 | * wants to move (-1 = previous file, 1 = next file, 0 = do nothing). |
45 | 45 | */ |
46 | | extern int mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line); |
| 46 | extern int mcview_viewer (const char *command, const char *file, int *move_dir_p, int start_line, int * run_editor); |
47 | 47 | |
48 | 48 | extern gboolean mcview_load (struct mcview_struct *, const char *, const char *, int); |
49 | 49 | |