Ticket #1523: added capability to forced run the internal editor.
Added CmdEditForceInternal binding in [main] section to forced run the internal editor of MC. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
1cc533eb17
Коммит
21e7453c94
@ -211,6 +211,7 @@ CmdUserMenu = f2
|
||||
CmdView = f3
|
||||
CmdViewFile = f13
|
||||
CmdEdit = f4
|
||||
CmdEditForceInternal =
|
||||
CmdCopy = f5
|
||||
CmdRename = f6
|
||||
CmdMkdir = f7
|
||||
|
@ -215,6 +215,7 @@ CmdUserMenu = f2
|
||||
CmdView = f3
|
||||
CmdViewFile = f13
|
||||
CmdEdit = f4
|
||||
CmdEditForceInternal =
|
||||
CmdCopy = f5
|
||||
CmdRename = f6
|
||||
CmdMkdir = f7
|
||||
|
17
src/cmd.c
17
src/cmd.c
@ -335,12 +335,12 @@ filtered_view_cmd (void)
|
||||
}
|
||||
|
||||
void
|
||||
do_edit_at_line (const char *what, int start_line)
|
||||
do_edit_at_line (const char *what, gboolean internal, int start_line)
|
||||
{
|
||||
static const char *editor = NULL;
|
||||
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
if (use_internal_edit)
|
||||
if (internal)
|
||||
edit_file (what, start_line);
|
||||
else
|
||||
#else
|
||||
@ -367,10 +367,10 @@ do_edit_at_line (const char *what, int start_line)
|
||||
repaint_screen ();
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
do_edit (const char *what)
|
||||
{
|
||||
do_edit_at_line (what, 0);
|
||||
do_edit_at_line (what, use_internal_edit, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -380,6 +380,15 @@ edit_cmd (void)
|
||||
do_edit (selection (current_panel)->fname);
|
||||
}
|
||||
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
void
|
||||
edit_cmd_force_internal (void)
|
||||
{
|
||||
if (regex_command (selection (current_panel)->fname, "Edit", NULL) == 0)
|
||||
do_edit_at_line (selection (current_panel)->fname, TRUE, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
edit_cmd_new (void)
|
||||
{
|
||||
|
@ -8,6 +8,8 @@
|
||||
#ifndef MC_CMD_H
|
||||
#define MC_CMD_H
|
||||
|
||||
#include "lib/global.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LINK_HARDLINK = 0,
|
||||
@ -31,9 +33,12 @@ void view_cmd (void);
|
||||
void view_file_cmd (void);
|
||||
void view_simple_cmd (void);
|
||||
void filtered_view_cmd (void);
|
||||
void do_edit_at_line (const char *what, int start_line);
|
||||
void do_edit_at_line (const char *what, gboolean internal, int start_line);
|
||||
void edit_cmd (void);
|
||||
void edit_cmd_new (void);
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
void edit_cmd_force_internal (void);
|
||||
#endif
|
||||
void copy_cmd (void);
|
||||
void copy_cmd_local (void);
|
||||
void rename_cmd (void);
|
||||
|
@ -390,6 +390,7 @@
|
||||
#define CK_DialogListCmd 7079
|
||||
#define CK_DialogNextCmd 7080
|
||||
#define CK_DialogPrevCmd 7081
|
||||
#define CK_EditForceInternalCmd 7082
|
||||
|
||||
/* panels */
|
||||
#define CK_PanelChdirOtherPanel 8001
|
||||
|
@ -2766,7 +2766,7 @@ dview_edit (WDiff * dview, int ord)
|
||||
|
||||
get_line_numbers (dview->a[ord], dview->skip_rows, &linenum, &lineofs);
|
||||
h->modal = TRUE; /* not allow edit file in several editors */
|
||||
do_edit_at_line (dview->file[ord], linenum);
|
||||
do_edit_at_line (dview->file[ord], use_internal_edit, linenum);
|
||||
h->modal = h_modal;
|
||||
dview_redo (dview);
|
||||
dview_update (dview);
|
||||
|
@ -1093,7 +1093,7 @@ find_do_view_edit (int unparsed_view, int edit, char *dir, char *file)
|
||||
|
||||
fullname = make_fullname (dir, filename);
|
||||
if (edit)
|
||||
do_edit_at_line (fullname, line);
|
||||
do_edit_at_line (fullname, use_internal_edit, line);
|
||||
else
|
||||
view_file_at_line (fullname, unparsed_view, use_internal_view, line);
|
||||
g_free (fullname);
|
||||
|
@ -336,6 +336,9 @@ static name_keymap_t command_names[] = {
|
||||
{ "CmdDirsizes", CK_DirsizesCmd },
|
||||
{ "CmdDisplayBitsBox", CK_DisplayBitsBox },
|
||||
{ "CmdEdit", CK_EditCmd },
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
{ "CmdEditForceInternal", CK_EditForceInternalCmd },
|
||||
#endif
|
||||
{ "CmdEditExtFile", CK_EditExtFileCmd },
|
||||
{ "CmdEditFhlFile", CK_EditFhlFileCmd },
|
||||
{ "CmdEditMcMenu", CK_EditMcMenuCmd },
|
||||
|
@ -1240,6 +1240,11 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
|
||||
case CK_EditCmd:
|
||||
edit_cmd ();
|
||||
break;
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
case CK_EditForceInternalCmd:
|
||||
edit_cmd_force_internal ();
|
||||
break;
|
||||
#endif
|
||||
case CK_EditExtFileCmd:
|
||||
ext_cmd ();
|
||||
break;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user