diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index db597af6..4ebb4daf 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -369,9 +369,12 @@ read_key(const unsigned char *key_str) return KBD_UNDEF; } -/* Parse the string @s as the name of a keystroke. - * Write the parsed key and modifiers to *@kbd. - * Return >=0 on success, <0 on error. */ +/** Parse the string @a s as the name of a keystroke. + * Write the parsed key and modifiers to *@a kbd. + * @return >=0 on success, <0 on error. + * + * This function does not support ::KBD_MOD_PASTE, because keystrokes + * that include it should never be bound to actions. */ int parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd) { @@ -443,6 +446,8 @@ add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, if (kbd->key == KBD_UNDEF) return; + /* Don't map KBD_MOD_PASTE to "Paste-" because parse_keystroke + * would not understand the result. */ if (kbd->modifier & KBD_MOD_SHIFT) add_to_string(str, "Shift-"); if (kbd->modifier & KBD_MOD_CTRL) diff --git a/src/terminal/kbd.h b/src/terminal/kbd.h index c42d3b6a..e277988f 100644 --- a/src/terminal/kbd.h +++ b/src/terminal/kbd.h @@ -33,6 +33,11 @@ typedef enum { KBD_MOD_SHIFT = 1, KBD_MOD_CTRL = 2, KBD_MOD_ALT = 4, + + /** The character is part of a string being pasted from the + * terminal. parse_keystroke() does not support this flag, so + * keystrokes that include it cannot be bound to any actions, + * and ELinks will instead insert the characters if possible. */ KBD_MOD_PASTE = 8, } term_event_modifier_T;