=== modified file 'man/termkey_strfkey.3' --- man/termkey_strfkey.3 2013-08-25 23:56:07 +0000 +++ man/termkey_strfkey.3 2012-04-24 23:59:13 +0000 @@ -27,9 +27,6 @@ .B TERMKEY_FORMAT_WRAPBRACKET If the key event is a special key instead of unmodified Unicode, wrap it in "\f(CW\fP". .TP -.B TERMKEY_FORMAT_SPACEMOD -Use spaces instead of hyphens to separate the modifier name(s) from the base key name. -.TP .B TERMKEY_FORMAT_MOUSE_POS If the event is a mouse event, include the position rendered as "\f(CW@ (col,line)\fP". .PP === modified file 'man/termkey_strpkey.3' --- man/termkey_strpkey.3 2013-08-25 23:56:07 +0000 +++ man/termkey_strpkey.3 2012-04-24 23:59:13 +0000 @@ -23,9 +23,6 @@ .TP .B TERMKEY_FORMAT_ALTISMETA Use the name "\f(CWMeta\fP" or the letter "\f(CWM\fP" instead of "\f(CWAlt\fP" or "\f(CWA\fP". -.TP -.B TERMKEY_FORMAT_SPACEMOD -Expect spaces instead of hyphens to separate the modifer name(s) from the base key name. .PP Before returning, this function canonicalises the \fIkey\fP structure according to the rules given for \fBtermkey_canonicalise\fP(3). .PP === modified file 't/11strfkey.c' --- t/11strfkey.c 2013-08-25 23:56:07 +0000 +++ t/11strfkey.c 2012-01-26 12:55:34 +0000 @@ -8,7 +8,7 @@ char buffer[16]; size_t len; - plan_tests(32); + plan_tests(28); tk = termkey_new_abstract("vt100", 0); @@ -38,11 +38,6 @@ is_int(len, 6, "length for unicode/b/CTRL longmod"); is_str(buffer, "Ctrl-b", "buffer for unicode/b/CTRL longmod"); - len = termkey_strfkey(tk, buffer, sizeof buffer, &key, - TERMKEY_FORMAT_LONGMOD|TERMKEY_FORMAT_SPACEMOD); - is_int(len, 6, "length for unicode/b/CTRL longmod|spacemod"); - is_str(buffer, "Ctrl b", "buffer for unicode/b/CTRL longmod|spacemod"); - len = termkey_strfkey(tk, buffer, sizeof buffer, &key, TERMKEY_FORMAT_CARETCTRL); is_int(len, 2, "length for unicode/b/CTRL caretctrl"); is_str(buffer, "^B", "buffer for unicode/b/CTRL caretctrl"); @@ -84,14 +79,6 @@ is_int(len, 4, "length for sym/Up/0 wrapbracket"); is_str(buffer, "", "buffer for sym/Up/0 wrapbracket"); - key.type = TERMKEY_TYPE_KEYSYM; - key.code.sym = TERMKEY_SYM_PAGEUP; - key.modifiers = 0; - - len = termkey_strfkey(tk, buffer, sizeof buffer, &key, 0); - is_int(len, 6, "length for sym/PageUp/0"); - is_str(buffer, "PageUp", "buffer for sym/PageUp/0"); - key.type = TERMKEY_TYPE_FUNCTION; key.code.number = 5; key.modifiers = 0; === modified file 't/12strpkey.c' --- t/12strpkey.c 2013-08-25 23:56:07 +0000 +++ t/12strpkey.c 2013-07-15 00:03:35 +0000 @@ -9,7 +9,7 @@ #define CLEAR_KEY do { key.type = -1; key.code.codepoint = -1; key.modifiers = -1; key.utf8[0] = 0; } while(0) - plan_tests(58); + plan_tests(53); tk = termkey_new_abstract("vt100", 0); @@ -86,14 +86,6 @@ is_str(endp, "", "consumed entire input for unicode/c/ALT altismeta+longmod"); CLEAR_KEY; - endp = termkey_strpkey(tk, "Meta c", &key, TERMKEY_FORMAT_ALTISMETA|TERMKEY_FORMAT_LONGMOD|TERMKEY_FORMAT_SPACEMOD); - is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type for unicode/c/ALT altismeta+long/lowermod"); - is_int(key.code.codepoint, 'c', "key.code.codepoint for unicode/c/ALT altismeta+long/lowermod"); - is_int(key.modifiers, TERMKEY_KEYMOD_ALT, "key.modifiers for unicode/c/ALT altismeta+long/lowermod"); - is_str(key.utf8, "c", "key.utf8 for unicode/c/ALT altismeta+long/lowermod"); - is_str(endp, "", "consumed entire input for unicode/c/ALT altismeta+longmod"); - - CLEAR_KEY; endp = termkey_strpkey(tk, "Up", &key, 0); is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type for sym/Up/0"); is_int(key.code.sym, TERMKEY_SYM_UP, "key.code.codepoint for sym/Up/0"); === modified file 'termkey.c' --- termkey.c 2013-08-25 23:56:07 +0000 +++ termkey.c 2013-07-15 00:03:35 +0000 @@ -1191,8 +1191,6 @@ int wrapbracket = (format & TERMKEY_FORMAT_WRAPBRACKET) && (key->type != TERMKEY_TYPE_UNICODE || key->modifiers != 0); - char sep = (format & TERMKEY_FORMAT_SPACEMOD) ? ' ' : '-'; - if(format & TERMKEY_FORMAT_CARETCTRL && key->type == TERMKEY_TYPE_UNICODE && key->modifiers == TERMKEY_KEYMOD_CTRL) { @@ -1221,19 +1219,19 @@ } if(key->modifiers & TERMKEY_KEYMOD_ALT) { - l = snprintf(buffer + pos, len - pos, "%s%c", mods->alt, sep); + l = snprintf(buffer + pos, len - pos, "%s-", mods->alt); if(l <= 0) return pos; pos += l; } if(key->modifiers & TERMKEY_KEYMOD_CTRL) { - l = snprintf(buffer + pos, len - pos, "%s%c", mods->ctrl, sep); + l = snprintf(buffer + pos, len - pos, "%s-", mods->ctrl); if(l <= 0) return pos; pos += l; } if(key->modifiers & TERMKEY_KEYMOD_SHIFT) { - l = snprintf(buffer + pos, len - pos, "%s%c", mods->shift, sep); + l = snprintf(buffer + pos, len - pos, "%s-", mods->shift); if(l <= 0) return pos; pos += l; } @@ -1322,10 +1320,10 @@ return (char *)str; } - const char *sep_at; + const char *hyphen; - while((sep_at = strchr(str, (format & TERMKEY_FORMAT_SPACEMOD) ? ' ' : '-'))) { - size_t n = sep_at - str; + while((hyphen = strchr(str, '-'))) { + size_t n = hyphen - str; if(n == strlen(mods->alt) && strncmp(mods->alt, str, n) == 0) key->modifiers |= TERMKEY_KEYMOD_ALT; @@ -1337,7 +1335,7 @@ else break; - str = sep_at + 1; + str = hyphen + 1; } size_t nbytes; === modified file 'termkey.h.in' --- termkey.h.in 2013-08-25 23:56:07 +0000 +++ termkey.h.in 2013-07-15 00:03:35 +0000 @@ -215,7 +215,6 @@ TERMKEY_FORMAT_CARETCTRL = 1 << 1, /* ^X instead of C-X */ TERMKEY_FORMAT_ALTISMETA = 1 << 2, /* Meta- or M- instead of Alt- or A- */ TERMKEY_FORMAT_WRAPBRACKET = 1 << 3, /* Wrap special keys in brackets like */ - TERMKEY_FORMAT_SPACEMOD = 1 << 4, /* M Foo instead of M-Foo */ TERMKEY_FORMAT_MOUSE_POS = 1 << 8 /* Include mouse position if relevant; @ col,line */ } TermKeyFormat;