Fix backspace option for new key format, GitHub issue 4284.

This commit is contained in:
nicm 2024-12-04 19:11:15 +00:00
parent 01edce40f3
commit 6d792e4123
2 changed files with 7 additions and 3 deletions

View File

@ -586,9 +586,11 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
/* Is this backspace? */
if ((key & KEYC_MASK_KEY) == KEYC_BSPACE) {
newkey = options_get_number(global_options, "backspace");
if (newkey >= 0x7f)
newkey = '\177';
key = newkey|(key & (KEYC_MASK_MODIFIERS|KEYC_MASK_FLAGS));
if (newkey == KEYC_BSPACE)
newkey = '\b';
log_debug("%s: key 0x%llx is backspace -> 0x%llx", __func__,
key, newkey|(key & KEYC_MASK_FLAGS));
key = newkey|(key & KEYC_MASK_FLAGS);
}
/* Is this backtab? */
@ -610,6 +612,7 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
if (!(key & ~KEYC_MASK_KEY)) {
if (key == C0_HT ||
key == C0_CR ||
key == C0_BS ||
key == C0_ESC ||
(key >= 0x20 && key <= 0x7f)) {
ud.data[0] = key;

View File

@ -894,6 +894,7 @@ first_key:
if (onlykey < 0x20 &&
onlykey != C0_HT &&
onlykey != C0_CR &&
onlykey != C0_BS &&
onlykey != C0_ESC) {
onlykey |= 0x40;
if (onlykey >= 'A' && onlykey <= 'Z')