From e7f44662e8f4763fa43126ac5f77a9c4edc5226e Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Sun, 17 Jul 2016 18:23:17 +0300
Subject: [PATCH 1/2] Ticket #3664: (midnight_callback): don't hardcode
alt-enter, ctrl-enter, ctrl-shift-enter.
---
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 89fa9a0..3db3a79 100644
a
|
b
|
static name_keymap_t command_names[] = { |
205 | 205 | {"SplitLess", CK_SplitLess}, |
206 | 206 | {"PutCurrentPath", CK_PutCurrentPath}, |
207 | 207 | {"PutOtherPath", CK_PutOtherPath}, |
| 208 | {"PutCurrentSelected", CK_PutCurrentSelected}, |
| 209 | {"PutCurrentFullSelected", CK_PutCurrentFullSelected}, |
208 | 210 | {"PutCurrentTagged", CK_PutCurrentTagged}, |
209 | 211 | {"PutOtherTagged", CK_PutOtherTagged}, |
210 | 212 | {"Select", CK_Select}, |
diff --git a/lib/keybind.h b/lib/keybind.h
index a88efbc..3484591 100644
a
|
b
|
enum |
178 | 178 | CK_LinkSymbolicRelative, |
179 | 179 | CK_PutCurrentPath, |
180 | 180 | CK_PutOtherPath, |
| 181 | CK_PutCurrentSelected, |
| 182 | CK_PutCurrentFullSelected, |
181 | 183 | CK_PutCurrentTagged, |
182 | 184 | CK_PutOtherTagged, |
183 | 185 | CK_Select, |
diff --git a/misc/mc.default.keymap b/misc/mc.default.keymap
index 9698bd5..7d61ff8 100644
a
|
b
|
SplitLess = alt-shift-left |
32 | 32 | Shell = ctrl-o |
33 | 33 | PutCurrentPath = alt-a |
34 | 34 | PutOtherPath = alt-shift-a |
| 35 | PutCurrentSelected = alt-enter; ctrl-enter |
| 36 | PutCurrentFullSelected = ctrl-shift-enter |
35 | 37 | ViewFiltered = alt-exclamation |
36 | 38 | Select = kpplus |
37 | 39 | Unselect = kpminus |
diff --git a/misc/mc.emacs.keymap b/misc/mc.emacs.keymap
index cfce480..8b4842a 100644
a
|
b
|
SplitLess = alt-shift-left |
32 | 32 | Shell = ctrl-o |
33 | 33 | PutCurrentPath = alt-a |
34 | 34 | PutOtherPath = alt-shift-a |
| 35 | PutCurrentSelected = alt-enter; ctrl-enter |
| 36 | PutCurrentFullSelected = ctrl-shift-enter |
35 | 37 | ViewFiltered = alt-exclamation |
36 | 38 | Select = kpplus |
37 | 39 | Unselect = kpminus |
diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c
index 2c31952..e312b2c 100644
a
|
b
|
put_other_link (void) |
784 | 784 | |
785 | 785 | /** Insert the selected file name into the input line */ |
786 | 786 | static void |
787 | | put_prog_name (void) |
| 787 | put_current_selected (void) |
788 | 788 | { |
789 | 789 | const char *tmp; |
790 | 790 | |
… |
… |
midnight_execute_cmd (Widget * sender, long command) |
1147 | 1147 | case CK_PutCurrentPath: |
1148 | 1148 | midnight_put_panel_path (current_panel); |
1149 | 1149 | break; |
| 1150 | case CK_PutCurrentSelected: |
| 1151 | put_current_selected (); |
| 1152 | break; |
| 1153 | case CK_PutCurrentFullSelected: |
| 1154 | midnight_put_panel_path (current_panel); |
| 1155 | put_current_selected (); |
| 1156 | break; |
1150 | 1157 | case CK_PutCurrentLink: |
1151 | 1158 | put_current_link (); |
1152 | 1159 | break; |
… |
… |
midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void |
1484 | 1491 | cmdline->point = 0; |
1485 | 1492 | } |
1486 | 1493 | |
1487 | | /* Ctrl-Enter and Alt-Enter */ |
1488 | | if (((parm & ~(KEY_M_CTRL | KEY_M_ALT)) == '\n') && (parm & (KEY_M_CTRL | KEY_M_ALT))) |
1489 | | { |
1490 | | put_prog_name (); |
1491 | | return MSG_HANDLED; |
1492 | | } |
1493 | | |
1494 | | /* Ctrl-Shift-Enter */ |
1495 | | if (parm == (KEY_M_CTRL | KEY_M_SHIFT | '\n')) |
1496 | | { |
1497 | | midnight_put_panel_path (current_panel); |
1498 | | put_prog_name (); |
1499 | | return MSG_HANDLED; |
1500 | | } |
1501 | | |
1502 | 1494 | if ((!mc_global.tty.alternate_plus_minus |
1503 | 1495 | || !(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) && !quote |
1504 | 1496 | && !current_panel->searching) |
diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c
index 20a31d3..38b4afb 100644
a
|
b
|
static const global_keymap_ini_t default_main_keymap[] = { |
100 | 100 | /* Copy useful information to the command line */ |
101 | 101 | {"PutCurrentPath", "alt-a"}, |
102 | 102 | {"PutOtherPath", "alt-shift-a"}, |
| 103 | {"PutCurrentSelected", "alt-enter; ctrl-enter"}, |
| 104 | {"PutCurrentFullSelected", "ctrl-shift-enter"}, |
103 | 105 | {"CdQuick", "alt-c"}, |
104 | 106 | /* To access the directory hotlist */ |
105 | 107 | {"HotList", "ctrl-backspace"}, |