diff --git a/misc/mc.keymap b/misc/mc.keymap index 2ce2fe2bf..d7e11adad 100644 --- a/misc/mc.keymap +++ b/misc/mc.keymap @@ -211,28 +211,28 @@ PanelSetPanelEncoding = ctrl-t [panel:xmap] -[widget] -WidgetBol = ctrl-a; alt-<; home -WidgetEol = ctrl-e; alt->; end -WidgetMoveLeft = alt-left -WidgetWordLeft = ctrl-left -WidgetBackwardChar = ctrl-b -WidgetBackwardWord = alt-b -WidgetMoveRight = alt-right -WidgetWordRight = ctrl-right -WidgetForwardChar = ctrl-f -WidgetForwardWord = alt-f +[input] +InputBol = ctrl-a; alt-<; home +InputEol = ctrl-e; alt->; end +InputMoveLeft = alt-left +InputWordLeft = ctrl-left +InputBackwardChar = ctrl-b +InputBackwardWord = alt-b +InputMoveRight = alt-right +InputWordRight = ctrl-right +InputForwardChar = ctrl-f +InputForwardWord = alt-f -WidgetBackwardDelete = backspace -WidgetDeleteChar = delete -WidgetKillWord = alt-d -WidgetBackwardKillWord = alt-backspace -WidgetSetMark = -WidgetKillRegion = ctrl-w -WidgetKillSave = alt-w -WidgetYank = ctrl-y -WidgetKillLine = ctrl-k -WidgetHistoryPrev = alt-p; ctrl-down -WidgetHistoryNext = alt-n; ctrl-up -WidgetHistoryShow = alt-h -WidgetComplete = alt-tab +InputBackwardDelete = backspace +InputDeleteChar = delete +InputKillWord = alt-d +InputBackwardKillWord = alt-backspace +InputSetMark = +InputKillRegion = ctrl-w +InputKillSave = alt-w +InputYank = ctrl-y +InputKillLine = ctrl-k +InputHistoryPrev = alt-p; ctrl-down +InputHistoryNext = alt-n; ctrl-up +InputHistoryShow = alt-h +InputComplete = alt-tab diff --git a/src/cmddef.h b/src/cmddef.h index 1eca59d90..999e20472 100644 --- a/src/cmddef.h +++ b/src/cmddef.h @@ -198,29 +198,29 @@ #define CK_StartExtMap2 2022 /* text fields*/ -#define CK_WidgetBol 4001 -#define CK_WidgetEol 4002 -#define CK_WidgetMoveLeft 4003 -#define CK_WidgetWordLeft 4004 -#define CK_WidgetBackwardChar 4005 -#define CK_WidgetBackwardWord 4006 -#define CK_WidgetMoveRight 4007 -#define CK_WidgetWordRight 4008 -#define CK_WidgetForwardChar 4009 -#define CK_WidgetForwardWord 4010 -#define CK_WidgetBackwardDelete 4011 -#define CK_WidgetDeleteChar 4012 -#define CK_WidgetKillWord 4013 -#define CK_WidgetBackwardKillWord 4014 -#define CK_WidgetSetMark 4015 -#define CK_WidgetKillRegion 4016 -#define CK_WidgetKillSave 4017 -#define CK_WidgetYank 4018 -#define CK_WidgetKillLine 4020 -#define CK_WidgetHistoryPrev 4021 -#define CK_WidgetHistoryNext 4022 -#define CK_WidgetHistoryShow 4023 -#define CK_WidgetComplete 4024 +#define CK_InputBol 4001 +#define CK_InputEol 4002 +#define CK_InputMoveLeft 4003 +#define CK_InputWordLeft 4004 +#define CK_InputBackwardChar 4005 +#define CK_InputBackwardWord 4006 +#define CK_InputMoveRight 4007 +#define CK_InputWordRight 4008 +#define CK_InputForwardChar 4009 +#define CK_InputForwardWord 4010 +#define CK_InputBackwardDelete 4011 +#define CK_InputDeleteChar 4012 +#define CK_InputKillWord 4013 +#define CK_InputBackwardKillWord 4014 +#define CK_InputSetMark 4015 +#define CK_InputKillRegion 4016 +#define CK_InputKillSave 4017 +#define CK_InputYank 4018 +#define CK_InputKillLine 4020 +#define CK_InputHistoryPrev 4021 +#define CK_InputHistoryNext 4022 +#define CK_InputHistoryShow 4023 +#define CK_InputComplete 4024 /* Viewer */ #define CK_ViewSearch 5001 diff --git a/src/keybind.c b/src/keybind.c index 0c57f12c4..feb01fa90 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -295,29 +295,29 @@ static const name_key_map_t command_names[] = { { "PanelSyncOtherPanel", CK_PanelSyncOtherPanel }, /* widgets */ - { "WidgetBol", CK_WidgetBol }, - { "WidgetEol", CK_WidgetEol }, - { "WidgetMoveLeft", CK_WidgetMoveLeft }, - { "WidgetWordLeft", CK_WidgetWordLeft }, - { "WidgetBackwardChar", CK_WidgetBackwardChar }, - { "WidgetBackwardWord", CK_WidgetBackwardWord }, - { "WidgetMoveRight", CK_WidgetMoveRight }, - { "WidgetWordRight", CK_WidgetWordRight }, - { "WidgetForwardChar", CK_WidgetForwardChar }, - { "WidgetForwardWord", CK_WidgetForwardWord }, - { "WidgetBackwardDelete", CK_WidgetBackwardDelete }, - { "WidgetDeleteChar", CK_WidgetDeleteChar }, - { "WidgetKillWord", CK_WidgetKillWord }, - { "WidgetBackwardKillWord", CK_WidgetBackwardKillWord }, - { "WidgetSetMark", CK_WidgetSetMark }, - { "WidgetKillRegion", CK_WidgetKillRegion }, - { "WidgetKillSave", CK_WidgetKillSave }, - { "WidgetYank", CK_WidgetYank }, - { "WidgetKillLine", CK_WidgetKillLine }, - { "WidgetHistoryPrev", CK_WidgetHistoryPrev }, - { "WidgetHistoryNext", CK_WidgetHistoryNext }, - { "WidgetHistoryShow", CK_WidgetHistoryShow }, - { "WidgetComplete", CK_WidgetComplete }, + { "InputBol", CK_InputBol }, + { "InputEol", CK_InputEol }, + { "InputMoveLeft", CK_InputMoveLeft }, + { "InputWordLeft", CK_InputWordLeft }, + { "InputBackwardChar", CK_InputBackwardChar }, + { "InputBackwardWord", CK_InputBackwardWord }, + { "InputMoveRight", CK_InputMoveRight }, + { "InputWordRight", CK_InputWordRight }, + { "InputForwardChar", CK_InputForwardChar }, + { "InputForwardWord", CK_InputForwardWord }, + { "InputBackwardDelete", CK_InputBackwardDelete }, + { "InputDeleteChar", CK_InputDeleteChar }, + { "InputKillWord", CK_InputKillWord }, + { "InputBackwardKillWord", CK_InputBackwardKillWord }, + { "InputSetMark", CK_InputSetMark }, + { "InputKillRegion", CK_InputKillRegion }, + { "InputKillSave", CK_InputKillSave }, + { "InputYank", CK_InputYank }, + { "InputKillLine", CK_InputKillLine }, + { "InputHistoryPrev", CK_InputHistoryPrev }, + { "InputHistoryNext", CK_InputHistoryNext }, + { "InputHistoryShow", CK_InputHistoryShow }, + { "InputComplete", CK_InputComplete }, /* common */ { "ExtMap1", CK_StartExtMap1 }, diff --git a/src/setup.c b/src/setup.c index d840c049c..ab69b1fbf 100644 --- a/src/setup.c +++ b/src/setup.c @@ -1008,7 +1008,7 @@ load_keymap_defs (void) load_keymap_from_section ("panel", panel_keymap, mc_global_keymap); widget_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t)); - load_keymap_from_section ("widget", widget_keymap, mc_global_keymap); + load_keymap_from_section ("input", widget_keymap, mc_global_keymap); mc_config_deinit(mc_global_keymap); } diff --git a/src/widget.c b/src/widget.c index 0582e2c74..22942ee43 100644 --- a/src/widget.c +++ b/src/widget.c @@ -63,44 +63,44 @@ const global_key_map_t *widget_map; const global_key_map_t default_widget_keymap[] = { /* Motion */ - { XCTRL('a'), CK_WidgetBol }, - { KEY_HOME, CK_WidgetBol }, - { KEY_A1, CK_WidgetBol }, - { ALT ('<'), CK_WidgetBol }, - { XCTRL('e'), CK_WidgetEol }, - { KEY_END, CK_WidgetEol }, - { KEY_C1, CK_WidgetEol }, - { ALT ('>'), CK_WidgetEol }, - { KEY_LEFT, CK_WidgetMoveLeft }, - { KEY_LEFT | KEY_M_CTRL, CK_WidgetWordLeft }, - { KEY_RIGHT, CK_WidgetMoveRight }, - { KEY_RIGHT | KEY_M_CTRL, CK_WidgetWordRight }, + { XCTRL('a'), CK_InputBol }, + { KEY_HOME, CK_InputBol }, + { KEY_A1, CK_InputBol }, + { ALT ('<'), CK_InputBol }, + { XCTRL('e'), CK_InputEol }, + { KEY_END, CK_InputEol }, + { KEY_C1, CK_InputEol }, + { ALT ('>'), CK_InputEol }, + { KEY_LEFT, CK_InputMoveLeft }, + { KEY_LEFT | KEY_M_CTRL, CK_InputWordLeft }, + { KEY_RIGHT, CK_InputMoveRight }, + { KEY_RIGHT | KEY_M_CTRL, CK_InputWordRight }, - { XCTRL('b'), CK_WidgetBackwardChar }, - { ALT('b'), CK_WidgetBackwardWord }, - { XCTRL('f'), CK_WidgetForwardChar }, - { ALT('f'), CK_WidgetForwardWord }, + { XCTRL('b'), CK_InputBackwardChar }, + { ALT('b'), CK_InputBackwardWord }, + { XCTRL('f'), CK_InputForwardChar }, + { ALT('f'), CK_InputForwardWord }, /* Editing */ - { KEY_BACKSPACE, CK_WidgetBackwardDelete }, - { KEY_DC, CK_WidgetDeleteChar }, - { ALT('d'), CK_WidgetKillWord }, - { ALT(KEY_BACKSPACE), CK_WidgetBackwardKillWord }, + { KEY_BACKSPACE, CK_InputBackwardDelete }, + { KEY_DC, CK_InputDeleteChar }, + { ALT('d'), CK_InputKillWord }, + { ALT(KEY_BACKSPACE), CK_InputBackwardKillWord }, /* Region manipulation */ - { 0, CK_WidgetSetMark }, - { XCTRL('w'), CK_WidgetKillRegion }, - { ALT('w'), CK_WidgetKillSave }, - { XCTRL('y'), CK_WidgetYank }, - { XCTRL('k'), CK_WidgetKillLine }, + { 0, CK_InputSetMark }, + { XCTRL('w'), CK_InputKillRegion }, + { ALT('w'), CK_InputKillSave }, + { XCTRL('y'), CK_InputYank }, + { XCTRL('k'), CK_InputKillLine }, /* History */ - { ALT('p'), CK_WidgetHistoryPrev }, - { ALT('n'), CK_WidgetHistoryNext }, - { ALT('h'), CK_WidgetHistoryShow }, + { ALT('p'), CK_InputHistoryPrev }, + { ALT('n'), CK_InputHistoryNext }, + { ALT('h'), CK_InputHistoryShow }, /* Completion */ - { ALT('\t'), CK_WidgetComplete }, + { ALT('\t'), CK_InputComplete }, { 0, 0 } }; @@ -1730,73 +1730,73 @@ static void widget_execute_cmd (WInput *in, int command, int key) { switch (command) { - case CK_WidgetBol: + case CK_InputBol: beginning_of_line (in); break; - case CK_WidgetEol: + case CK_InputEol: end_of_line (in); break; - case CK_WidgetMoveLeft: + case CK_InputMoveLeft: key_left (in); break; - case CK_WidgetWordLeft: + case CK_InputWordLeft: key_ctrl_left (in); break; - case CK_WidgetMoveRight: + case CK_InputMoveRight: key_right (in); break; - case CK_WidgetWordRight: + case CK_InputWordRight: key_ctrl_right (in); break; - case CK_WidgetBackwardChar: + case CK_InputBackwardChar: backward_char (in); break; - case CK_WidgetBackwardWord: + case CK_InputBackwardWord: backward_word (in); break; - case CK_WidgetForwardChar: + case CK_InputForwardChar: forward_char (in); break; - case CK_WidgetForwardWord: + case CK_InputForwardWord: forward_word (in); break; - case CK_WidgetBackwardDelete: + case CK_InputBackwardDelete: backward_delete (in); break; - case CK_WidgetDeleteChar: + case CK_InputDeleteChar: delete_char (in); break; - case CK_WidgetKillWord: + case CK_InputKillWord: kill_word (in); break; - case CK_WidgetBackwardKillWord: + case CK_InputBackwardKillWord: back_kill_word (in); break; - case CK_WidgetSetMark: + case CK_InputSetMark: set_mark (in); break; - case CK_WidgetKillRegion: + case CK_InputKillRegion: kill_region (in); break; - case CK_WidgetKillSave: + case CK_InputKillSave: kill_save (in); break; - case CK_WidgetYank: + case CK_InputYank: yank (in); break; - case CK_WidgetKillLine: + case CK_InputKillLine: kill_line (in); break; - case CK_WidgetHistoryPrev: + case CK_InputHistoryPrev: hist_prev (in); break; - case CK_WidgetHistoryNext: + case CK_InputHistoryNext: hist_next (in); break; - case CK_WidgetHistoryShow: + case CK_InputHistoryShow: do_show_hist (in); break; - case CK_WidgetComplete: + case CK_InputComplete: complete (in); break; } @@ -1813,7 +1813,7 @@ is_in_input_map (WInput *in, int key) for (i = 0; widget_map[i].key; i++) { if (key == widget_map[i].key) { widget_execute_cmd (in, widget_map[i].command, key); - if (widget_map[i].command == CK_WidgetComplete) + if (widget_map[i].command == CK_InputComplete) return 2; else return 1; @@ -1840,7 +1840,7 @@ handle_char (WInput *in, int key) for (i = 0; widget_map[i].key; i++) { if (key == widget_map[i].key) { - if (widget_map[i].command != CK_WidgetComplete) { + if (widget_map[i].command != CK_InputComplete) { free_completions (in); widget_execute_cmd (in, widget_map[i].command, key); update_input (in, 1);