"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "key-string.c" between
tmux-3.2.tar.gz and tmux-3.2a.tar.gz

About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.

key-string.c  (tmux-3.2):key-string.c  (tmux-3.2a)
skipping to change at line 167 skipping to change at line 167
} }
*string += 2; *string += 2;
} }
return (modifiers); return (modifiers);
} }
/* Lookup a string and convert to a key value. */ /* Lookup a string and convert to a key value. */
key_code key_code
key_string_lookup_string(const char *string) key_string_lookup_string(const char *string)
{ {
static const char *other = "!#()+,-.0123456789:;<=>'\r\t\177"; static const char *other = "!#()+,-.0123456789:;<=>'\r\t\177`/";
key_code key, modifiers; key_code key, modifiers;
u_int u, i; u_int u, i;
struct utf8_data ud, *udp; struct utf8_data ud, *udp;
enum utf8_state more; enum utf8_state more;
utf8_char uc; utf8_char uc;
char m[MB_LEN_MAX + 1]; char m[MB_LEN_MAX + 1];
int mlen; int mlen;
/* Is this no key or any key? */ /* Is this no key or any key? */
if (strcasecmp(string, "None") == 0) if (strcasecmp(string, "None") == 0)
skipping to change at line 241 skipping to change at line 241
/* Otherwise look the key up in the table. */ /* Otherwise look the key up in the table. */
key = key_string_search_table(string); key = key_string_search_table(string);
if (key == KEYC_UNKNOWN) if (key == KEYC_UNKNOWN)
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
if (~modifiers & KEYC_META) if (~modifiers & KEYC_META)
key &= ~KEYC_IMPLIED_META; key &= ~KEYC_IMPLIED_META;
} }
/* Convert the standard control keys. */ /* Convert the standard control keys. */
if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && if (key <= 127 &&
strchr(other, key) == NULL) { (modifiers & KEYC_CTRL) &&
strchr(other, key) == NULL &&
key != 9 &&
key != 13 &&
key != 27) {
if (key >= 97 && key <= 122) if (key >= 97 && key <= 122)
key -= 96; key -= 96;
else if (key >= 64 && key <= 95) else if (key >= 64 && key <= 95)
key -= 64; key -= 64;
else if (key == 32) else if (key == 32)
key = 0; key = 0;
else if (key == 63) else if (key == 63)
key = 127; key = 127;
else else
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
skipping to change at line 367 skipping to change at line 371
/* Try the key against the string table. */ /* Try the key against the string table. */
for (i = 0; i < nitems(key_string_table); i++) { for (i = 0; i < nitems(key_string_table); i++) {
if (key == (key_string_table[i].key & KEYC_MASK_KEY)) if (key == (key_string_table[i].key & KEYC_MASK_KEY))
break; break;
} }
if (i != nitems(key_string_table)) { if (i != nitems(key_string_table)) {
strlcat(out, key_string_table[i].string, sizeof out); strlcat(out, key_string_table[i].string, sizeof out);
goto out; goto out;
} }
/* Is this a UTF-8 key? */ /* Is this a Unicode key? */
if (key > 127 && key < KEYC_BASE) { if (KEYC_IS_UNICODE(key)) {
utf8_to_data(key, &ud); utf8_to_data(key, &ud);
off = strlen(out); off = strlen(out);
memcpy(out + off, ud.data, ud.size); memcpy(out + off, ud.data, ud.size);
out[off + ud.size] = '\0'; out[off + ud.size] = '\0';
goto out; goto out;
} }
/* Invalid keys are errors. */ /* Invalid keys are errors. */
if (key > 255) { if (key > 255) {
snprintf(out, sizeof out, "Invalid#%llx", saved); snprintf(out, sizeof out, "Invalid#%llx", saved);
 End of changes. 3 change blocks. 
5 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)