added a new action "Record and Repeat commands", added menu entry (Record/Repeat actions) for this.
Signed-off-by: Ilia Maslakov <il.smind@gmail.com> some fixes Signed-off-by: Slava Zanko <slavazanko@gmail.com> and one more fix Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
6066713f77
Коммит
83177cfc16
@ -134,6 +134,7 @@ static name_keymap_t command_names[] = {
|
||||
{"EditUserMenu", CK_User_Menu},
|
||||
{"EditBeginRecordMacro", CK_Begin_Record_Macro},
|
||||
{"EditEndRecordMacro", CK_End_Record_Macro},
|
||||
{"EditBeginEndRepeat", CK_Begin_End_Repeat},
|
||||
{"EditDeleteMacro", CK_Delete_Macro},
|
||||
{"EditToggleBookmark", CK_Toggle_Bookmark},
|
||||
{"EditFlushBookmarks", CK_Flush_Bookmarks},
|
||||
|
@ -189,19 +189,22 @@
|
||||
#define CK_Paragraph_Down_Alt_Highlight 671
|
||||
|
||||
/* X clipboard operations */
|
||||
#define CK_XStore 701
|
||||
#define CK_XCut 702
|
||||
#define CK_XPaste 703
|
||||
#define CK_Selection_History 704
|
||||
#define CK_XStore 701
|
||||
#define CK_XCut 702
|
||||
#define CK_XPaste 703
|
||||
#define CK_Selection_History 704
|
||||
|
||||
#define CK_Shell 801
|
||||
#define CK_Shell 801
|
||||
|
||||
/* C-x or similar */
|
||||
#define CK_Ext_Mode 820
|
||||
#define CK_Ext_Mode 820
|
||||
|
||||
#define CK_Insert_Literal 851
|
||||
#define CK_Execute_Macro 852
|
||||
#define CK_Begin_End_Macro 853
|
||||
#define CK_Insert_Literal 851
|
||||
#define CK_Execute_Macro 852
|
||||
#define CK_Begin_End_Macro 853
|
||||
#define CK_Begin_End_Repeat 854
|
||||
#define CK_Begin_Record_Repeat 855
|
||||
#define CK_End_Record_Repeat 856
|
||||
|
||||
/* help */
|
||||
#define CK_HelpHelp 1001
|
||||
|
@ -160,6 +160,8 @@ EditFindDefinition = alt-enter
|
||||
EditLoadPrevFile = alt-minus
|
||||
EditLoadNextFile = alt-plus
|
||||
|
||||
EditBeginEndRepeat =
|
||||
|
||||
SelectCodepage = alt-e
|
||||
|
||||
[viewer]
|
||||
|
@ -157,6 +157,8 @@ EditFindDefinition = alt-enter
|
||||
EditLoadPrevFile = alt-minus
|
||||
EditLoadNextFile = alt-plus
|
||||
|
||||
EditBeginEndRepeat =
|
||||
|
||||
SelectCodepage = alt-e
|
||||
|
||||
EditExtMode = ctrl-x
|
||||
|
@ -308,6 +308,7 @@ void edit_help_cmd (WEdit * edit);
|
||||
int edit_store_macro_cmd (WEdit * edit);
|
||||
gboolean edit_load_macro_cmd (WEdit * edit);
|
||||
void edit_delete_macro_cmd (WEdit * edit);
|
||||
gboolean edit_repeat_macro_cmd (WEdit * edit);
|
||||
|
||||
int edit_copy_to_X_buf_cmd (WEdit * edit);
|
||||
int edit_cut_to_X_buf_cmd (WEdit * edit);
|
||||
@ -318,6 +319,7 @@ void edit_insert_literal_cmd (WEdit * edit);
|
||||
void edit_execute_macro_cmd (WEdit * edit);
|
||||
gboolean edit_execute_macro (WEdit * edit, int hotkey);
|
||||
void edit_begin_end_macro_cmd (WEdit * edit);
|
||||
void edit_begin_end_repeat_cmd (WEdit * edit);
|
||||
|
||||
void edit_paste_from_history (WEdit * edit);
|
||||
|
||||
|
@ -3379,18 +3379,29 @@ edit_find_bracket (WEdit * edit)
|
||||
void
|
||||
edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
{
|
||||
if (command == CK_Begin_Record_Macro || (command == CK_Begin_End_Macro && macro_index < 0))
|
||||
if (command == CK_Begin_Record_Macro || command == CK_Begin_Record_Repeat
|
||||
|| (macro_index < 0 && (command == CK_Begin_End_Macro || command == CK_Begin_End_Repeat)))
|
||||
{
|
||||
macro_index = 0;
|
||||
edit->force |= REDRAW_CHAR_ONLY | REDRAW_LINE;
|
||||
return;
|
||||
}
|
||||
if ((command == CK_End_Record_Macro || command == CK_Begin_End_Macro) && macro_index != -1)
|
||||
if (macro_index != -1)
|
||||
{
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit_store_macro_cmd (edit);
|
||||
macro_index = -1;
|
||||
return;
|
||||
if (command == CK_End_Record_Macro || command == CK_Begin_End_Macro)
|
||||
{
|
||||
edit_store_macro_cmd (edit);
|
||||
macro_index = -1;
|
||||
return;
|
||||
}
|
||||
else if (command == CK_End_Record_Repeat || command == CK_Begin_End_Repeat)
|
||||
{
|
||||
edit_repeat_macro_cmd (edit);
|
||||
macro_index = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (macro_index >= 0 && macro_index < MAX_MACRO_LENGTH - 1)
|
||||
@ -4117,6 +4128,9 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
case CK_Begin_End_Macro:
|
||||
edit_begin_end_macro_cmd (edit);
|
||||
break;
|
||||
case CK_Begin_End_Repeat:
|
||||
edit_begin_end_repeat_cmd (edit);
|
||||
break;
|
||||
case CK_Ext_Mode:
|
||||
edit->extmod = 1;
|
||||
break;
|
||||
|
@ -1590,7 +1590,7 @@ edit_store_macro_cmd (WEdit * edit)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
edit_repeat_macro_cmd (WEdit * edit)
|
||||
@ -1600,7 +1600,7 @@ edit_repeat_macro_cmd (WEdit * edit)
|
||||
long count_repeat;
|
||||
char *error = NULL;
|
||||
|
||||
f = input_dialog (_("Repeat last commands"), _("Repeat times:"), NULL, "1");
|
||||
f = input_dialog (_("Repeat last commands"), _("Repeat times:"), MC_HISTORY_EDIT_REPEAT, NULL);
|
||||
if (f == NULL || *f == '\0')
|
||||
{
|
||||
g_free (f);
|
||||
@ -1609,7 +1609,7 @@ edit_repeat_macro_cmd (WEdit * edit)
|
||||
|
||||
count_repeat = strtol (f, &error, 0);
|
||||
|
||||
if (error != NULL)
|
||||
if (*error != '\0')
|
||||
{
|
||||
g_free (f);
|
||||
return FALSE;
|
||||
@ -1618,8 +1618,8 @@ edit_repeat_macro_cmd (WEdit * edit)
|
||||
g_free (f);
|
||||
|
||||
edit_push_undo_action (edit, KEY_PRESS + edit->start_display);
|
||||
|
||||
edit->force |= REDRAW_PAGE;
|
||||
|
||||
for (j = 0; j < count_repeat; j++)
|
||||
for (i = 0; i < macro_index; i++)
|
||||
edit_execute_cmd (edit, record_macro_buf[i].action, record_macro_buf[i].ch);
|
||||
@ -3155,13 +3155,26 @@ void
|
||||
edit_begin_end_macro_cmd (WEdit * edit)
|
||||
{
|
||||
/* edit is a pointer to the widget */
|
||||
if (edit)
|
||||
if (edit != NULL)
|
||||
{
|
||||
unsigned long command = macro_index < 0 ? CK_Begin_Record_Macro : CK_End_Record_Macro;
|
||||
edit_execute_key_command (edit, command, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
edit_begin_end_repeat_cmd (WEdit * edit)
|
||||
{
|
||||
/* edit is a pointer to the widget */
|
||||
if (edit != NULL)
|
||||
{
|
||||
unsigned long command = macro_index < 0 ? CK_Begin_Record_Repeat : CK_End_Record_Repeat;
|
||||
edit_execute_key_command (edit, command, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
|
@ -170,6 +170,7 @@ create_command_menu (void)
|
||||
g_list_append (entries,
|
||||
menu_entry_create (_("&Start/Stop record macro"), CK_Begin_End_Macro));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Delete macr&o..."), CK_Delete_Macro));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Record/Repeat &actions"), CK_Begin_End_Repeat));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries =
|
||||
g_list_append (entries, menu_entry_create (_("'ispell' s&pell check"), CK_Pipe_Block (1)));
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define MC_HISTORY_EDIT_GOTO_LINE "mc.edit.goto-line"
|
||||
#define MC_HISTORY_EDIT_SORT "mc.edit.sort"
|
||||
#define MC_HISTORY_EDIT_PASTE_EXTCMD "mc.edit.paste-extcmd"
|
||||
#define MC_HISTORY_EDIT_REPEAT "mc.edit.repeat-action"
|
||||
|
||||
#define MC_HISTORY_FM_VIEW_FILE "mc.fm.view-file"
|
||||
#define MC_HISTORY_FM_MKDIR "mc.fm.mkdir"
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user