From 4a0f265d95643b4f0f84c388b12acf1f406b63a6 Mon Sep 17 00:00:00 2001 From: Mooffie Date: Sun, 17 Jul 2016 18:23:17 +0300 Subject: [PATCH] Ticket #3075: (midnight_callback): make alt-enter, ctrl-enter, ctrl-shift-enter bindable. Signed-off-by: Andrew Borodin --- lib/keybind.c | 2 ++ lib/keybind.h | 2 ++ misc/mc.default.keymap | 2 ++ misc/mc.emacs.keymap | 2 ++ src/filemanager/midnight.c | 24 ++++++++---------------- src/keybind-defaults.c | 2 ++ 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/keybind.c b/lib/keybind.c index 89fa9a02d..3db3a7992 100644 --- a/lib/keybind.c +++ b/lib/keybind.c @@ -205,6 +205,8 @@ static name_keymap_t command_names[] = { {"SplitLess", CK_SplitLess}, {"PutCurrentPath", CK_PutCurrentPath}, {"PutOtherPath", CK_PutOtherPath}, + {"PutCurrentSelected", CK_PutCurrentSelected}, + {"PutCurrentFullSelected", CK_PutCurrentFullSelected}, {"PutCurrentTagged", CK_PutCurrentTagged}, {"PutOtherTagged", CK_PutOtherTagged}, {"Select", CK_Select}, diff --git a/lib/keybind.h b/lib/keybind.h index a88efbc14..3484591b0 100644 --- a/lib/keybind.h +++ b/lib/keybind.h @@ -178,6 +178,8 @@ enum CK_LinkSymbolicRelative, CK_PutCurrentPath, CK_PutOtherPath, + CK_PutCurrentSelected, + CK_PutCurrentFullSelected, CK_PutCurrentTagged, CK_PutOtherTagged, CK_Select, diff --git a/misc/mc.default.keymap b/misc/mc.default.keymap index 9698bd58d..7d61ff834 100644 --- a/misc/mc.default.keymap +++ b/misc/mc.default.keymap @@ -32,6 +32,8 @@ SplitLess = alt-shift-left Shell = ctrl-o PutCurrentPath = alt-a PutOtherPath = alt-shift-a +PutCurrentSelected = alt-enter; ctrl-enter +PutCurrentFullSelected = ctrl-shift-enter ViewFiltered = alt-exclamation Select = kpplus Unselect = kpminus diff --git a/misc/mc.emacs.keymap b/misc/mc.emacs.keymap index cfce480ca..8b4842a7e 100644 --- a/misc/mc.emacs.keymap +++ b/misc/mc.emacs.keymap @@ -32,6 +32,8 @@ SplitLess = alt-shift-left Shell = ctrl-o PutCurrentPath = alt-a PutOtherPath = alt-shift-a +PutCurrentSelected = alt-enter; ctrl-enter +PutCurrentFullSelected = ctrl-shift-enter ViewFiltered = alt-exclamation Select = kpplus Unselect = kpminus diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index 68d12dac0..40c8ba71b 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -781,7 +781,7 @@ put_other_link (void) /** Insert the selected file name into the input line */ static void -put_prog_name (void) +put_current_selected (void) { const char *tmp; @@ -1139,6 +1139,13 @@ midnight_execute_cmd (Widget * sender, long command) case CK_PutCurrentPath: midnight_put_panel_path (current_panel); break; + case CK_PutCurrentSelected: + put_current_selected (); + break; + case CK_PutCurrentFullSelected: + midnight_put_panel_path (current_panel); + put_current_selected (); + break; case CK_PutCurrentLink: put_current_link (); break; @@ -1476,21 +1483,6 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void cmdline->point = 0; } - /* Ctrl-Enter and Alt-Enter */ - if (((parm & ~(KEY_M_CTRL | KEY_M_ALT)) == '\n') && (parm & (KEY_M_CTRL | KEY_M_ALT))) - { - put_prog_name (); - return MSG_HANDLED; - } - - /* Ctrl-Shift-Enter */ - if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n')) - { - midnight_put_panel_path (current_panel); - put_prog_name (); - return MSG_HANDLED; - } - if ((!mc_global.tty.alternate_plus_minus || !(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) && !quote && !current_panel->searching) diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c index 9d926196f..d4d1496cf 100644 --- a/src/keybind-defaults.c +++ b/src/keybind-defaults.c @@ -100,6 +100,8 @@ static const global_keymap_ini_t default_main_keymap[] = { /* Copy useful information to the command line */ {"PutCurrentPath", "alt-a"}, {"PutOtherPath", "alt-shift-a"}, + {"PutCurrentSelected", "alt-enter; ctrl-enter"}, + {"PutCurrentFullSelected", "ctrl-shift-enter"}, {"CdQuick", "alt-c"}, /* To access the directory hotlist */ {"HotList", "ctrl-backslash"},