1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Support Ctrl-Alt-letter key combinations.

Actions can now be bound to e.g. Ctrl-Alt-A.  The keybinding code also
supports other combinations of modifiers, like Shift-Ctrl-Up, but the
escape sequence decoder doesn't yet.

Don't let Ctrl-Alt-letter combinations open menus.
This commit is contained in:
Kalle Olavi Niemitalo 2006-08-13 15:32:06 +03:00 committed by Kalle Olavi Niemitalo
parent 6108c3e109
commit de93359a5a
4 changed files with 22 additions and 19 deletions

View File

@ -911,8 +911,7 @@ push_kbdbind_add_button(struct dialog_data *dlg_data,
"Keymap: %s\n"
"\n"
"Keystroke should be written in the format: "
"[Prefix-]Key\n"
"Prefix: Shift, Ctrl, Alt\n"
"[Shift-][Ctrl-][Alt-]Key\n"
"Key: a,b,c,...,1,2,3,...,Space,Up,PageDown,"
"Tab,Enter,Insert,F5,..."
"\n\n"

View File

@ -374,24 +374,27 @@ parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
{
unsigned char ctrlbuf[2];
if (!strncasecmp(s, "Shift", 5) && (s[5] == '-' || s[5] == '+')) {
/* Shift+a == shiFt-a == Shift-a */
kbd->modifier = KBD_MOD_SHIFT;
s += 6;
kbd->modifier = KBD_MOD_NONE;
while (1) {
if (!strncasecmp(s, "Shift", 5) && (s[5] == '-' || s[5] == '+')) {
/* Shift+a == shiFt-a == Shift-a */
kbd->modifier |= KBD_MOD_SHIFT;
s += 6;
} else if (!strncasecmp(s, "Ctrl", 4) && (s[4] == '-' || s[4] == '+')) {
/* Ctrl+a == ctRl-a == Ctrl-a */
kbd->modifier = KBD_MOD_CTRL;
s += 5;
} else if (!strncasecmp(s, "Ctrl", 4) && (s[4] == '-' || s[4] == '+')) {
/* Ctrl+a == ctRl-a == Ctrl-a */
kbd->modifier |= KBD_MOD_CTRL;
s += 5;
} else if (!strncasecmp(s, "Alt", 3) && (s[3] == '-' || s[3] == '+')) {
/* Alt+a == aLt-a == Alt-a */
kbd->modifier = KBD_MOD_ALT;
s += 4;
} else if (!strncasecmp(s, "Alt", 3) && (s[3] == '-' || s[3] == '+')) {
/* Alt+a == aLt-a == Alt-a */
kbd->modifier |= KBD_MOD_ALT;
s += 4;
} else {
/* No modifier. */
kbd->modifier = KBD_MOD_NONE;
} else {
/* No modifier. */
break;
}
}
if ((kbd->modifier & KBD_MOD_CTRL) != 0 && s[0] && !s[1]) {

View File

@ -865,7 +865,7 @@ set_kbd_event(struct interlink_event *ev, int key, int modifier)
default:
if (key < ' ') {
key += 'A' - 1;
modifier = KBD_MOD_CTRL;
modifier |= KBD_MOD_CTRL;
}
}

View File

@ -1169,7 +1169,8 @@ quit:
if (check_kbd_key(ev, KBD_CTRL_C)) goto quit;
if (get_kbd_modifier(ev) & KBD_MOD_ALT) {
/* Ctrl-Alt-F should not open the File menu like Alt-f does. */
if (check_kbd_modifier(ev, KBD_MOD_ALT)) {
struct window *win;
get_kbd_modifier(ev) &= ~KBD_MOD_ALT;