mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Merge branch 'obsd-master' into master
This commit is contained in:
commit
998a6b0aea
@ -164,7 +164,7 @@ key_string_get_modifiers(const char **string)
|
||||
key_code
|
||||
key_string_lookup_string(const char *string)
|
||||
{
|
||||
static const char *other = "!#()+,-.0123456789:;<=>'\r\t";
|
||||
static const char *other = "!#()+,-.0123456789:;<=>'\r\t\177";
|
||||
key_code key, modifiers;
|
||||
u_int u, i;
|
||||
struct utf8_data ud, *udp;
|
||||
@ -238,11 +238,11 @@ key_string_lookup_string(const char *string)
|
||||
}
|
||||
|
||||
/* Convert the standard control keys. */
|
||||
if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && !strchr(other, key)) {
|
||||
if (key < KEYC_BASE && (modifiers & KEYC_CTRL) &&
|
||||
strchr(other, key) == NULL &&
|
||||
(key < 64 || key > 95)) {
|
||||
if (key >= 97 && key <= 122)
|
||||
key -= 96;
|
||||
else if (key >= 64 && key <= 95)
|
||||
key -= 64;
|
||||
else if (key == 32)
|
||||
key = 0;
|
||||
else if (key == 63)
|
||||
|
45
tty-keys.c
45
tty-keys.c
@ -869,6 +869,8 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
|
||||
size_t end;
|
||||
u_int number, modifiers;
|
||||
char tmp[64];
|
||||
cc_t bspace;
|
||||
key_code nkey;
|
||||
|
||||
*size = 0;
|
||||
|
||||
@ -911,38 +913,61 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
|
||||
}
|
||||
*size = end + 1;
|
||||
|
||||
/* Store the key and modifiers. */
|
||||
*key = number;
|
||||
/* Store the key. */
|
||||
bspace = tty->tio.c_cc[VERASE];
|
||||
if (bspace != _POSIX_VDISABLE && number == bspace)
|
||||
nkey = KEYC_BSPACE;
|
||||
else
|
||||
nkey = number;
|
||||
|
||||
/* Update the modifiers. */
|
||||
switch (modifiers) {
|
||||
case 2:
|
||||
(*key) |= KEYC_SHIFT;
|
||||
nkey |= KEYC_SHIFT;
|
||||
break;
|
||||
case 3:
|
||||
(*key) |= (KEYC_META|KEYC_IMPLIED_META);
|
||||
nkey |= (KEYC_META|KEYC_IMPLIED_META);
|
||||
break;
|
||||
case 4:
|
||||
(*key) |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META);
|
||||
nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META);
|
||||
break;
|
||||
case 5:
|
||||
(*key) |= KEYC_CTRL;
|
||||
nkey |= KEYC_CTRL;
|
||||
break;
|
||||
case 6:
|
||||
(*key) |= (KEYC_SHIFT|KEYC_CTRL);
|
||||
nkey |= (KEYC_SHIFT|KEYC_CTRL);
|
||||
break;
|
||||
case 7:
|
||||
(*key) |= (KEYC_META|KEYC_CTRL);
|
||||
nkey |= (KEYC_META|KEYC_CTRL);
|
||||
break;
|
||||
case 8:
|
||||
(*key) |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL);
|
||||
nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL);
|
||||
break;
|
||||
default:
|
||||
*key = KEYC_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't allow both KEYC_CTRL and implied. */
|
||||
if ((nkey & KEYC_CTRL) && (nkey & KEYC_MASK_KEY) < 32)
|
||||
nkey &= ~KEYC_CTRL;
|
||||
if ((nkey & KEYC_MASK_MODIFIERS) == KEYC_CTRL) {
|
||||
nkey &= KEYC_MASK_KEY;
|
||||
if (nkey >= 97 && nkey <= 122)
|
||||
nkey -= 96;
|
||||
else if (nkey == 32)
|
||||
nkey = 0;
|
||||
else if (nkey == 63)
|
||||
nkey = 127;
|
||||
else
|
||||
nkey |= KEYC_CTRL;
|
||||
}
|
||||
|
||||
if (log_get_level() != 0) {
|
||||
log_debug("%s: extended key %.*s is %llx (%s)", c->name,
|
||||
(int)*size, buf, *key, key_string_lookup_key(*key, 1));
|
||||
(int)*size, buf, nkey, key_string_lookup_key(nkey, 1));
|
||||
}
|
||||
*key = nkey;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user