Merge branch 'obsd-master' into master

pull/2648/head
Thomas Adam 2021-04-07 18:01:20 +01:00
commit a57c2bf97e
2 changed files with 24 additions and 15 deletions

View File

@ -239,10 +239,11 @@ key_string_lookup_string(const char *string)
/* Convert the standard control keys. */ /* Convert the standard control keys. */
if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && if (key < KEYC_BASE && (modifiers & KEYC_CTRL) &&
strchr(other, key) == NULL && strchr(other, key) == NULL) {
(key < 64 || key > 95)) {
if (key >= 97 && key <= 122) if (key >= 97 && key <= 122)
key -= 96; key -= 96;
else if (key >= 64 && key <= 95)
key -= 64;
else if (key == 32) else if (key == 32)
key = 0; key = 0;
else if (key == 63) else if (key == 63)

View File

@ -871,6 +871,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
char tmp[64]; char tmp[64];
cc_t bspace; cc_t bspace;
key_code nkey; key_code nkey;
key_code onlykey;
*size = 0; *size = 0;
@ -948,19 +949,26 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
break; break;
} }
/* Don't allow both KEYC_CTRL and implied. */ /*
if ((nkey & KEYC_CTRL) && (nkey & KEYC_MASK_KEY) < 32) * Don't allow both KEYC_CTRL and as an implied modifier. Also convert
nkey &= ~KEYC_CTRL; * C-X into C-x and so on.
if ((nkey & KEYC_MASK_MODIFIERS) == KEYC_CTRL) { */
nkey &= KEYC_MASK_KEY; if (nkey & KEYC_CTRL){
if (nkey >= 97 && nkey <= 122) onlykey = (nkey & KEYC_MASK_KEY);
nkey -= 96; if (onlykey < 32)
else if (nkey == 32) onlykey = (nkey & ~KEYC_CTRL);
nkey = 0; else {
else if (nkey == 63) if (onlykey >= 97 && onlykey <= 122)
nkey = 127; onlykey -= 96;
else else if (onlykey >= 64 && onlykey <= 95)
nkey |= KEYC_CTRL; onlykey -= 64;
else if (onlykey == 32)
onlykey = 0;
else if (onlykey == 63)
onlykey = 127;
onlykey |= ((nkey & KEYC_MASK_MODIFIERS) & ~KEYC_CTRL);
}
nkey = onlykey;
} }
if (log_get_level() != 0) { if (log_get_level() != 0) {