bindings: hard-bind the zap function to M-Del (Alt+Delete)

So that the function is available in a default setup.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
master
Brand Huntsman 2018-10-24 03:17:28 -06:00 committed by Benno Schulenberg
parent ae3ec1784d
commit 252f14796e
7 changed files with 16 additions and 1 deletions

View File

@ -1161,6 +1161,7 @@ current cursor position.
@item zap @item zap
Throw away the current line (or the marked region). Throw away the current line (or the marked region).
(This function is bound by default to <Meta+Delete>.)
@item cutwordleft @item cutwordleft
Cuts from the cursor position to the beginning of the preceding word. Cuts from the cursor position to the beginning of the preceding word.

View File

@ -512,6 +512,7 @@ current cursor position.
.TP .TP
.B zap .B zap
Throw away the current line (or the marked region). Throw away the current line (or the marked region).
(This function is bound by default to <Meta+Delete>.)
.TP .TP
.B cutwordleft .B cutwordleft
Cuts from the cursor position to the beginning of the preceding word. Cuts from the cursor position to the beginning of the preceding word.

View File

@ -76,6 +76,7 @@ int shiftleft, shiftright, shiftup, shiftdown;
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown; int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
int shiftcontrolhome, shiftcontrolend; int shiftcontrolhome, shiftcontrolend;
int altleft, altright, altup, altdown; int altleft, altright, altup, altdown;
int altdelete;
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown; int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#endif #endif
@ -1156,6 +1157,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-E", 0, do_redo, 0); add_to_sclist(MMAIN, "M-E", 0, do_redo, 0);
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, do_cut_prev_word, 0); add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, do_cut_prev_word, 0);
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, do_cut_next_word, 0); add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, do_cut_next_word, 0);
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
#endif #endif
#ifdef ENABLE_WORDCOMPLETION #ifdef ENABLE_WORDCOMPLETION
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0); add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);

View File

@ -2596,6 +2596,7 @@ int main(int argc, char **argv)
altright = get_keycode("kRIT3", ALT_RIGHT); altright = get_keycode("kRIT3", ALT_RIGHT);
altup = get_keycode("kUP3", ALT_UP); altup = get_keycode("kUP3", ALT_UP);
altdown = get_keycode("kDN3", ALT_DOWN); altdown = get_keycode("kDN3", ALT_DOWN);
altdelete = get_keycode("kDC3", ALT_DELETE);
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT); shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
shiftaltright = get_keycode("kRIT4", SHIFT_ALT_RIGHT); shiftaltright = get_keycode("kRIT4", SHIFT_ALT_RIGHT);

View File

@ -594,6 +594,7 @@ enum
#define ALT_RIGHT 0x422 #define ALT_RIGHT 0x422
#define ALT_UP 0x423 #define ALT_UP 0x423
#define ALT_DOWN 0x424 #define ALT_DOWN 0x424
#define ALT_DELETE 0x427
#define SHIFT_ALT_LEFT 0x431 #define SHIFT_ALT_LEFT 0x431
#define SHIFT_ALT_RIGHT 0x432 #define SHIFT_ALT_RIGHT 0x432
#define SHIFT_ALT_UP 0x433 #define SHIFT_ALT_UP 0x433

View File

@ -67,6 +67,7 @@ extern int shiftcontrolup, shiftcontroldown;
extern int shiftcontrolhome, shiftcontrolend; extern int shiftcontrolhome, shiftcontrolend;
extern int altleft, altright; extern int altleft, altright;
extern int altup, altdown; extern int altup, altdown;
extern int altdelete;
extern int shiftaltleft, shiftaltright; extern int shiftaltleft, shiftaltright;
extern int shiftaltup, shiftaltdown; extern int shiftaltup, shiftaltdown;
#endif #endif

View File

@ -576,7 +576,10 @@ int parse_kbinput(WINDOW *win)
return ALT_UP; return ALT_UP;
else if (retval == altdown) else if (retval == altdown)
return ALT_DOWN; return ALT_DOWN;
else if (retval == shiftaltleft) { else if (retval == altdelete) {
meta_key = TRUE;
return ALT_DELETE;
} else if (retval == shiftaltleft) {
shift_held = TRUE; shift_held = TRUE;
return KEY_HOME; return KEY_HOME;
} else if (retval == shiftaltright) { } else if (retval == shiftaltright) {
@ -609,6 +612,11 @@ int parse_kbinput(WINDOW *win)
/* Are both Shift and Ctrl being held while Delete is pressed? */ /* Are both Shift and Ctrl being held while Delete is pressed? */
if ((modifiers & 0x05) == 0x05 && retval == KEY_DC) if ((modifiers & 0x05) == 0x05 && retval == KEY_DC)
return CONTROL_SHIFT_DELETE; return CONTROL_SHIFT_DELETE;
/* Is Meta being held while Delete is pressed? */
if (modifiers == 0x08 && retval == KEY_DC) {
meta_key = TRUE;
return ALT_DELETE;
}
#endif #endif
/* Is Ctrl being held? */ /* Is Ctrl being held? */
if (modifiers & 0x04) { if (modifiers & 0x04) {